	<!--
function first()
{
	var alt = document.Alt_calc.input_alt.value;

	if (alt == ""){
			alert("Enter an altitude.");
		}

		else if (alt > 30000 || alt < 1){
			alert("Enter a value less than 30000 or greater than 0");
		}

	else {
		var x0 = 0;
		var y0 = 29.92;
		var x10 = 10000;
		var y10 = 20.57;
		var x20 = 20000;
		var y20 = 13.74;
		var x30 = 30000;
		var y30 = 8.89;

		var answer = 0;

	  	if (alt < 10000){
	  		interpolate(x0,y0,x10,y10,alt);
		}

        else if (alt >= 10000 && alt < 20000){
        	interpolate(x10,y10,x20,y20,alt);
        }
        else {
        	interpolate(x20,y20,x30,y30,alt);
        }
	}
}

function interpolate(x1,y1,x2,y2,Xint)
{
	Yint = (((y2-y1) / (x2-x1)) * (Xint-x1)) + y1;
	answer = ((29.92 - Yint)/29.92) * 100;
	roundedanswer=Math.round(answer);
	document.Alt_calc.result.value=roundedanswer;
}

	//-->
