<!-- Begin
var Orig=new Array();
var Dest=new Array();
var degrees=0;
var nautical=0;
var statute=0;
var kilometers=0;
var nm=0;
var tc=0;

function DoCalc(form) {
var page = document.airportto;
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));
form.nautical.value =(nm+"\n");
form.degrees.value =(tc+ "\n");
form.statute.value =(Math.round(nm*1.13636)+"\n");
form.kilometers.value =(Math.round(nm*1.6094));
   }
}
// End -->

