// JavaScript Document
function confirmDelete()
{
var agree=confirm("Are you sure you want to delete?");
if (agree)
return true ;
else
return false ;
}

function open_window(url)
{
cwin = window.open(url,"attach","width=350,height=400,toolbar=no,resizable=yes");
}
var Orig=new Array();
var Dest=new Array();
var nm=0;
var tc=0;
function DoCalc(form) {
from_airport=form.from.options[form.from.selectedIndex].value;
dest_airport=form.to.options[form.to.selectedIndex].value;

if (from_airport=="" || dest_airport=="") {
alert("Please enter both an Originating and Destination Airport.");
}
else {
Orig=from_airport.split("/");
Dest=dest_airport.split("/");
d=Math.acos(Math.sin(Orig[2])
*Math.sin(Dest[2])
+Math.cos(Orig[2])
*Math.cos(Dest[2])
*Math.cos(Orig[4]-Dest[4]));
nm=Math.round(3437.747*d);
if (Math.sin(Dest[4]-Orig[4]) < 0) {
tc=Math.acos((Math.sin(Dest[2])
-Math.sin(Orig[2])*Math.cos(d))
/(Math.sin(d)*Math.cos(Orig[2])));
} 
else { 
tc=2*Math.PI
-Math.acos((Math.sin(Dest[2])
-Math.sin(Orig[2])
*Math.cos(d))/(Math.sin(d)
*Math.cos(Orig[2])));
}
tc=Math.round(tc*(180/Math.PI));
message=(Orig[0] + " to " + Dest[0] + "\n\n");
message+=("Degrees:  " +tc+ "\n");
message+=("Nautical Miles: "+nm+"\n");
message+=("Statute Miles: "+Math.round(nm*1.13636)+"\n");
message+=("Kilometers: "+Math.round(nm*1.6094));
alert(message);
   }
}
function  _CF_checkCFForm_1(_CF_this)
    {
        //reset on submit
        _CF_error_exists = false;
        _CF_error_messages = new Array();
        _CF_error_fields = new Object();
        _CF_FirstErrorField = null;

        //form element fName required check
        if( !_CF_hasValue(_CF_this['fName'], "TEXT", false ) )
        {
            _CF_onError(_CF_this, "fName", _CF_this['fName'].value, "Please enter your first name.");
            _CF_error_exists = true;
        }

        //form element lName required check
        if( !_CF_hasValue(_CF_this['lName'], "TEXT", false ) )
        {
            _CF_onError(_CF_this, "lName", _CF_this['lName'].value, "Please enter your last name.");
            _CF_error_exists = true;
        }

        //form element eName required check
        if( !_CF_hasValue(_CF_this['eName'], "TEXT", false ) )
        {
            _CF_onError(_CF_this, "eName", _CF_this['eName'].value, "Please enter your email address.");
            _CF_error_exists = true;
        }

        //form element cPhone required check
        if( !_CF_hasValue(_CF_this['cPhone'], "TEXT", false ) )
        {
            _CF_onError(_CF_this, "cPhone", _CF_this['cPhone'].value, "Please enter your phone number with area code.");
            _CF_error_exists = true;
        }


        //display error messages and return success
        if( _CF_error_exists )
        {
            if( _CF_error_messages.length > 0 )
            {
                // show alert() message
                _CF_onErrorAlert(_CF_error_messages);
                // set focus to first form error, if the field supports js focus().
                if( _CF_this[_CF_FirstErrorField].type == "text" )
                { _CF_this[_CF_FirstErrorField].focus(); }

            }
            return false;
        }else {
            return true;
        }
    }
	