function calculate_redshift(form)
  {
    var red = new Array(0.00000,
    0.00050,
    0.00077,
    0.00543,
    0.01521,
    0.02515,
    0.03520,
    0.04542,
    0.05579,
    0.06631,
    0.07699,
    0.08784,
    0.09884,
    0.11006,
    0.12141,
    0.13296,
    0.14470,
    0.15663,
    0.16875,
    0.18113,
    0.19366,
    0.20643,
    0.21943,
    0.23266,
    0.24614,
    0.25987,
    0.27381,
    0.28807,
    0.30259,
    0.31740,
    0.33250,
    0.34792,
    0.36365,
    0.37969,
    0.39609,
    0.41284,
    0.42997,
    0.44748,
    0.46539,
    0.48373,
    0.50246,
    0.52168,
    0.54137,
    0.56155,
    0.58225,
    0.60348,
    0.62526,
    0.64768,
    0.67069,
    0.69436,
    0.71871,
    0.74377,
    0.76962,
    0.79625,
    0.82372,
    0.85208,
    0.88139,
    0.91169,
    0.94304,
    0.97552,
    1.00918,
    1.04411,
    1.08039,
    1.11811,
    1.15742,
    1.19832,
    1.24102,
    1.28561,
    1.33227,
    1.38113,
    1.43240,
    1.48626,
    1.54295,
    1.60273,
    1.66588,
    1.73272,
    1.80364,
    1.87905,
    1.95942,
    2.04539,
    2.13753,
    2.23664,
    2.34363,
    2.45958,
    2.58574,
    2.72369,
    2.87534,
    3.04301,
    3.22963,
    3.43891,
    3.67568,
    3.94625,
    4.25914,
    4.62611,
    5.06391,
    5.59747,
    6.26553,
    7.13222,
    8.31300,
    9.77165,
    11.45962,
    13.40032,
    15.63864,
    18.20470,
    21.16239,
    24.50704,
    28.44840,
    32.88660,
    37.91766,
    43.87284,
    50.66115,
    57.80013,
    66.03968,
    75.14620,
    84.38944,
    97.06677,
    100.0000,
    101.0);
	
	var time = new Array(0.0,
		     16.80,
	     	 18.20,
	     	 22.40,
	     	 26.60,
	     	 32.20,
	     	 39.20,
	     	 47.60,
	     	 58.80,
	     	 72.80,
	     	 89.60,
	     	110.60,
	     	137.20,
	     	169.40,
	     	210.00,
	     	260.40,
	     	323.40,
	     	401.80,
	     	499.80,
	     	621.60,
	     	761.60,
	     	901.60,
	       1041.60,
	       1181.60,
	       1321.60,
	       1461.60,
	       1601.60,
	       1741.60,
	       1881.60,
	       2021.60,
	       2161.60,
	       2301.60,
	       2441.60,
	       2581.60,
	       2721.60,
	       2861.60,
	       3001.60,
	       3141.60,
	       3281.60,
	       3421.60,
	       3561.60,
	       3701.60,
	       3841.60,
	       3981.60,
	       4121.60,
	       4261.60,
	       4401.60,
	       4541.60,
	       4681.60,
	       4821.60,
	       4961.60,
	       5101.60,
	       5241.60,
	       5381.60,
	       5521.60,
	       5661.60,
	       5801.60,
	       5941.60,
	       6081.60,
	       6221.60,
	       6361.60,
	       6501.60,
	       6641.60,
	       6781.60,
	       6921.60,
	       7061.60,
	       7201.60,
	       7341.60,
	       7481.60,
	       7621.60,
	       7761.60,
	       7901.60,
	       8041.60,
	       8181.60,
	       8321.60,
	       8461.60,
	       8601.60,
	       8741.60,
	       8881.60,
	       9021.60,
	       9161.60,
	       9301.60,
	       9441.60,
	       9581.60,
	       9721.60,
	       9861.60,
	      10001.60,
	      10141.60,
	      10281.60,
	      10421.60,
	      10561.60,
	      10701.60,
	      10841.60,
	      10981.60,
	      11121.60,
	      11261.60,
	      11401.60,
	      11541.60,
	      11681.60,
	      11821.60,
	      11961.60,
	      12101.60,
	      12241.60,
	      12381.60,
	      12521.60,
	      12661.60,
	      12801.60,
	      12941.60,
	      13081.60,
	      13221.60,
	      13361.60,
	      13501.60,
	      13641.60,
	      13781.60,
	      13921.60,
	      13988.80,
	      13993.00,
	      14000.00);

    var finl = 0;
	var input = parseFloat(form.elements['input'].value);
	
	// If we are going from one to the SAME
	if (form.elements['input_unit'].selectedIndex == form.elements['output_unit'].selectedIndexx)
	  {
	    finl = input;
	  }
	// Else, if we are converting from red to time
	else if (form.elements['input_unit'].selectedIndex == 0)
	  {
	    // Valid between 0 and 100
		if ((input > 100) || (input < 0))
		  {
		    alert("Redshift values must be between 0 and 100.  The redshift models outside of this range become very uncertain and we are not able to give you an answer!");
            return;
		  }
		  
	    // Look for the interpolation
		for (var i = 0; i < red.length; i++)
		  {
		    if (input <= red[i]) { break; }
		  }
		  
		finl = time[i] - (((red[i] - input) / (red[i] - red[i-1])) * (time[i] - time[i-1]));
	  }
	// Else, we are converting from time to red
	else
	  {
	    // Valididate data
		if ((input > 14000) || (input < 16.8))
		  {
		    alert("Time values must be between 16.8 and 14000 million years.  The redshift models outside of this range become very uncertain and we are not able to give you an answer!");
            return;
		  }

	    // Look for the interpolation
		for (var i = 0; i < time.length; i++)
		  {
		    if (input <= time[i]) { break; }
		  }
		  
		finl = red[i] - (((time[i] - input) / (time[i] - time[i-1])) * (red[i] - red[i-1]));
	  }    
	  
	// Display it
    form.elements['answer'].value = finl;
  }