/////////////////////////////////////////////////////////////////////////
//   windchill.js -- <!--  Wind Chill Computer copyright 1996 Bernard N. Meisner
//
//   Author:  Bernard N. Meisner, Scientific Services Division, NWS SRHQ
//
//   Latest Revision:  October 3, 2001
/////////////////////////////////////////////////////////////////////////

function ComputeWindChill() {
    Temp = document.Input.Temperature.value;
    Wind = document.Input.WindSpeed.value;

    TempF =  9.0*Temp/5.0 + 32.0;
    Units = '°C';
	
	
     if ( document.Input.WindUnits[0].checked ) WindMph = 2.23693*Wind;
     if ( document.Input.WindUnits[1].checked ) WindMph = 0.62136*Wind;
	 if ( WindMph <= 3 ) WindMph = 3.0;

 
	 WindChill = ( 35.74 + 0.6215*TempF - 35.75*Math.pow(WindMph,0.16) + 0.4275*TempF*Math.pow(WindMph,0.16) );

     WindChill = 5.0*(WindChill-32.0)/9.0;

     if ( WindChill > Temp) WindChill = Temp;

     document.Input.windchill.value = Math.round(WindChill) + Units;

	 if (TempF > 45.0 || TempF < -45.0 || WindMph > 60.0 ) {
  	 document.Input.windchill.value = "indefinit";
	 }

}
//  End of windchill.js