			function errorMsg() {
				alert ("Error: Please check the values you have entered into the route calculator.");
					}

			window.onerror = errorMsg;

			function fit15() {
					if (naismith >=7) {
						tot_time = ((1.175 * naismith ) - 4) ;
							}
					else {
						tot_time = naismith ;
							}
					if (tot_time >= 24.2) {
						alert ("Warning: This journey may be too difficult for your party. The maximum recommended trip should not exceed 24.2 hours.") ;
							} 
					}

			function fit20() {
					if (naismith >=7) {
						tot_time = ((1.3 * naismith ) - 3) ;
							}
					else {
						tot_time = naismith ;
							}
					if (tot_time >= 23) {
						alert ("Warning: This journey may be too difficult for your party. The maximum recommended trip should not exceed 23 hours.") ;
							} 
					}

			function fit25() {
					if (naismith >=4) {
						tot_time = ((1.3 * naismith ) - 0.7) ;
							}
					else {
						tot_time = naismith ;
							}
					if (tot_time >= 17.5) {
						alert ("Warning: This journey may be too difficult for your party. The maximum recommended trip should not exceed 17.5 hours.") ;
							} 
					}

			function fit30() {
					if (naismith >= 3) {
						tot_time = ((1.9 * naismith ) - 2.6) ;
							}
					else {
						tot_time = naismith ;
							}
					if (tot_time >= 14.5) {
						alert ("Warning: This journey may be too difficult for your party. The maximum recommended trip should not exceed 14.5 hours.") ;
							} 
					}

			function fit40() {
					if (naismith >=2) {
						tot_time = ((1.8 * naismith ) - 1.1) ;
							}
					else {
						tot_time = naismith ;
							}
					if (tot_time >= 11.5) {
						alert ("Warning: This journey may be too difficult for your party. The maximum recommended trip should not exceed 11.5 hours.") ;
							} 
					}

			function fit50() {
					if (naismith >=1) {
						tot_time = ((1.75 * naismith ) - 0.25) ;
							}
					else {
						tot_time = naismith ;
							}
					if (tot_time >= 8.5) {
						alert ("Warning: This journey may be too difficult for your party. The maximum recommended trip should not exceed 8.5 hours.") ;
							} 
					}

			function round(value) {
						rounded = (Math.round(value * 100))/100 ;
					}				

			function compute(form) {
	
				height = eval(form.height.value) ;
				time1 = height / 2000 ;

				distance = eval(form.distance.value) ;
				time2 = distance / 3;

				weight = eval(form.weight.value) ;
				tod = eval(form.tod.value) ;
				clarity = eval(form.clarity.value) ;
				wind = eval(form.wind.value) ;
				ground = eval(form.ground.value) ;
				loading = (weight + tod + clarity + wind + ground) ;
				
				naismith = eval(time1 + time2) ;

				fitness = eval(form.fitness.value) + loading

				if ( fitness < 5 ) {
						alert ("Warning: Conditions for this journey may be too dangerous for your party to attempt. ") ;
						fit50(naismith) ;
						}

				if ( (fitness >= 5)  && (fitness < 6) ) {
						fit50(naismith) ;
						}

				if ( (fitness >= 6)  && (fitness < 7) ) {
						fit40(naismith) ;
						}

				if ( (fitness >= 7) && (fitness < 8) ) {
						fit30(naismith) ;
						}

				if ( (fitness >= 8) && (fitness < 9) ) {
						fit25(naismith) ;
						}

				if ( (fitness >= 9) && (fitness < 10) ) {
						fit20(naismith) ;
						}

				if ( fitness >= 10 ) {
						fit15(naismith) ;
						}
				
				round(tot_time) ;
				
				form.result.value = rounded ;

			return ;
			}
