<!--
function urlencode(value) {
   return value.replace(/ /g,"+");
}
function swap() {
   var tmp = document.calculator.from.value;
   document.calculator.from.value = document.calculator.to.value;
   document.calculator.to.value = tmp;
}
function home() {
   var form = document.calculator;
   var index = form.type.options.selectedIndex;
   if (index == 0) {
      alert("Please select which type of calculation you want to get.");
      form.type.focus();
   } else if (form.from.value.length == 0) {
      alert("Please enter your starting location.");
      form.from.focus();
   } else if (index == 3 || index == 4 || index == 7) {
		var type = form.type.value;
		var url = "http://www.flightpedia.org/";
		form.action = url+type+".html";
		form.submit();
		return;
   } else if(index == 6){
   		var type = form.type.value;
		var url = "http://hotels.flightpedia.org/search.html";
		form.submit();
		return;
   } 
   else if ((index ==1 || index == 2)&& form.to.value.length == 0) {
      alert("Please enter your destination.");
      form.to.focus();
   }
   return false;
}
function changetype() {
   if (document.calculator.type.options.selectedIndex == 3 ||
      document.calculator.type.options.selectedIndex == 4 ||
	  document.calculator.type.options.selectedIndex == 5 ||
	  document.calculator.type.options.selectedIndex == 7 ||
      document.calculator.type.options.selectedIndex == 6) {
      document.getElementById('CalcToRow').style.display = 'none';
      document.getElementById('CalcSwap').style.display = 'none';
      document.getElementById('CalcFrom').innerHTML =
	 '<strong>Name:</strong>';
   } else if (document.calculator.type.options.selectedIndex == 11) {
      document.getElementById('CalcToRow').style.display = 'none';
      document.getElementById('CalcSwap').style.display = 'none';
      document.getElementById('CalcFrom').innerHTML = '<strong>of:</strong>';
   } else {
      document.getElementById('CalcToRow').style.display = '';
      document.getElementById('CalcSwap').style.display = '';
      document.getElementById('CalcFrom').innerHTML = '<strong>From:</strong>';
   }
}
function redirect(form) {
   if (form.type.value == "flight-distance" ||
      form.type.value == "flight") {
      if (form.from.value.length == 0) {
		alert("Please enter your starting location.");
	 form.from.focus();
      } else if (form.to.value.length == 0) {
	 alert("Please enter your destination.");
	 form.to.focus();
     }
	} else if (form.type.value.length > 0) {
      if (form.from.value.length == 0) {
	 alert("Please enter your location.");
	 form.from.focus();
      } 
   }
   return false;
}
// -->
