nav_home = new Image();
nav_home.src = 'http://www.travelmath.com/img/nav/home2.jpg';
nav_flights = new Image();
nav_flights.src = 'http://www.travelmath.com/img/nav/flights2.jpg';
nav_driving = new Image();
nav_driving.src = 'http://www.travelmath.com/img/nav/driving2.jpg';
nav_distance = new Image();
nav_distance.src = 'http://www.travelmath.com/img/nav/distance2.jpg';
nav_time = new Image();
nav_time.src = 'http://www.travelmath.com/img/nav/time2.jpg';
nav_cost = new Image();
nav_cost.src = 'http://www.travelmath.com/img/nav/cost2.jpg';
nav_places = new Image();
nav_places.src = 'http://www.travelmath.com/img/nav/places2.jpg';
<!--
function over(name) {
   document.images['nav_'+name].src = 'http://www.travelmath.com/img/nav/' + name + '2.jpg';
}
function out(name) {
   document.images['nav_'+name].src = 'http://www.travelmath.com/img/nav/' + name + '.jpg';
}
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.path.options.selectedIndex;
   if (index == 0) {
      alert("Please select which type of calculation you want to get.");
      form.path.focus();
   } else if (form.from.value.length == 0) {
      alert("Please enter your starting location.");
      form.from.focus();
   } else if (index == 3 || index == 6 || index == 7 || index == 11) {
      window.location = "http://www.travelmath.com/" +
	 form.path.options[index].value + "/" + urlencode(form.from.value);
   } else if (form.to.value.length == 0) {
      alert("Please enter your destination.");
      form.to.focus();
   } else {
      window.location = "http://www.travelmath.com/" +
	 form.path.options[index].value + "/from/" +
	 urlencode(form.from.value) + "/to/" + urlencode(form.to.value);
   }
   return false;
}
function changepath() {
   if (document.calculator.path.options.selectedIndex == 3 ||
      document.calculator.path.options.selectedIndex == 6 ||
      document.calculator.path.options.selectedIndex == 7) {
      document.getElementById('CalcToRow').style.display = 'none';
      document.getElementById('CalcSwap').style.display = 'none';
      document.getElementById('CalcFrom').innerHTML =
	 '<strong>near/in:</strong>';
   } else if (document.calculator.path.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.path.value == "flight-distance" ||
      form.path.value == "flight-time" ||
      form.path.value == "driving-distance" ||
      form.path.value == "drive-time" ||
      form.path.value == "time-difference" ||
      form.path.value == "fuel-cost" ||
      form.path.value == "flight-emissions") {
      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 {
	 window.location = "http://www.travelmath.com/" + form.path.value + "/from/"
	    + urlencode(form.from.value) + "/to/" + urlencode(form.to.value);
      }
   } else if (form.path.value.length > 0) {
      if (form.from.value.length == 0) {
	 alert("Please enter your location.");
	 form.from.focus();
      } else {
	 window.location = "http://www.travelmath.com/" + form.path.value +
	    "/" + urlencode(form.from.value);
      }
   }
   return false;
}
// -->
