 
function MyFunction2()
{
	window.document.myfrm.reslt.value="";
}
 
function MyFunction()
{
	var my_number = 0;
	var my_car  = 0;
	my_car = window.document.myfrm.cars.options.value;
	my_number = window.document.myfrm.mils.value;

	if(my_number <=0)
	{ 
		alert('Please enter total number of miles! \nIf you are not sure how far your trip is, \nget an estimate from Yahoo Maps (http://maps.yahoo.com).')
	}
	else
	{ 
		if(my_car=="ven")
		{
			total=((my_number*2)+(((my_number*2)/100)*50)); 
			if(total<=50){total=50;}
			window.document.myfrm.reslt.value = total;
		} 
		if(my_car=="lnc")
		{ 
			total=((my_number*2)); 
			if(total<=35)
			  {
				total=35;
			  }
			window.document.myfrm.reslt.value = total;
		}
		if(my_car=="car") 
		{ 
			alert('Type of car is not selected!') 
		}           
	}
}

 
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);
	}
}