<!--Do not add this line if already in your header. -->

<!-- NWS English/Metric Wind Chill Calculator 1.0  10/28/03 -->
<!-- Written by Bryan Ruby (bryan.ruby@noaa.gov), National Weather Service, Sioux Falls -->

<!-- Begin
function windChill(form) {

wind=eval(form.wind.value);
temp=eval(form.temp.value);
tempUnits=(form.tempUnits.selectedIndex);
windUnits=(form.windUnits.selectedIndex);
limit="Undefined";

<!-- Fahrenheit and MPH -->
if ((tempUnits==0) && (windUnits==0)) {
     windchill=(35.74+0.6215*temp-35.75*Math.pow(wind,0.16)+0.4275*temp*Math.pow(wind,0.16));
     windchillC= Math.round((windchill - 32) * .556) + " °C";
     windchill="               " + Math.round(windchill) + " °F          ( " + windchillC + " )               "; 
     <!-- Wind Thresholds -->
     windchill=((wind <= 3) || (wind >= 110 )) ? "Winds need to be above 3 MPH and below 110 MPH." : windchill;
     <!-- Max Ambient Temperature Thresholds -->
     windchill=((temp <= -50) || (temp >= 50)) ? "Temperatures need to be above -50 °F and below 50 °F": windchill;
     }

<!-- Celsius and km/hr -->
if ((tempUnits==1) && (windUnits==1)) {
     windchill=(13.12+0.6215*temp-11.37*Math.pow(wind,0.16)+0.3965*temp*Math.pow(wind,0.16));
     windchillF=Math.round(1.8*windchill+32) + " °F";
     windchill="               " + Math.round(windchill) + " °C          ( " + windchillF + " )               ";
     <!-- Wind Thresholds -->
     windchill=((wind <= 4.8) || (wind >= 177)) ? "Winds need to be above 4.8 km/hr and below 177 km/hr." : windchill;
     <!-- Max Ambient Temperature Thresholds -->
     windchill=((temp <= -50) || (temp >= 10)) ? "Temperatures need be to above -50 °C and below 10 °C" : windchill;
     }

<!-- Farenheit and km/hr -->
if ((tempUnits==0) && (windUnits==1)) {
     <!-- Convert km/hr to MPH -->
     wind = 0.621371 * wind;
     windchill=(35.74+0.6215*temp-35.75*Math.pow(wind,0.16)+0.4275*temp*Math.pow(wind,0.16));
     windchillc= Math.round((windchill - 32) * .556) + " °C";
     windchill="               " + Math.round(windchill) + " °F          ( " + windchillc + " )               "; 
     <!-- Wind Thresholds in MPH but alert user in km/hr -->
     windchill=((wind <= 3) || (wind >= 110 ))  ? "Winds need to be above 4.8 km/hr and below 177 km/hr." : windchill;
     <!-- Max Ambient Temperature Thresholds -->
     windchill=((temp <= -50) || (temp >= 50)) ? "Temperatures need to be above -50 °F and below 50 °F": windchill;
     }
     
<!-- Celsius and MPH -->
if ((tempUnits==1) && (windUnits==0)) {
     <!-- Convert MPH to km/hr -->
     wind = 1.609344 * wind;
     windchill=(13.12+0.6215*temp-11.37*Math.pow(wind,0.16)+0.3965*temp*Math.pow(wind,0.16));
     windchillF=Math.round(1.8*windchill+32) + " °F";
     windchill="               " + Math.round(windchill) + " °C          ( " + windchillF + " )               ";
     <!-- Wind Thresholds -->
     windchill=((wind <= 4.8) || (wind >= 177)) ? "Winds need to be above 3 MPH and below 110 MPH." : windchill;
     <!-- Max Ambient Temperature Thresholds -->
     windchill=((temp <= -50) || (temp >= 10)) ? "Temperatures need be to above -50 °C and below 10 °C" : windchill;
     }
     
<!-- Insert Values Back Into Form Fields -->
form.windchill.value = windchill;

}

//  End -->
