function displayWUNDER(URI){var xmlhttpw=false;/*@cc_on @*/if(!xmlhttpw&&typeof XMLHttpRequest!='undefined'){xmlhttpw=new XMLHttpRequest();}
xmlhttpw.open("GET",URI,true);xmlhttpw.onreadystatechange=function(){if(xmlhttpw.readyState==2){}
if(xmlhttpw.readyState==4){if(xmlhttpw.status==200){var xmlDoc=xmlhttpw.responseXML;formatWUNDER(xmlDoc);}}}
xmlhttpw.send(null);}
function formatWUNDER(xmlDoc){var tc,tdc;var ages=xmlDoc.getElementsByTagName('ages')[0].getAttribute('val');var agem=xmlDoc.getElementsByTagName('agem')[0].getAttribute('val');var ageh=xmlDoc.getElementsByTagName('ageh')[0].getAttribute('val');var heatindexf=xmlDoc.getElementsByTagName('heatindexf')[0].getAttribute('val');$('dateutc').innerHTML=xmlDoc.getElementsByTagName('dateutc')[0].getAttribute('val');$('winddir').innerHTML=lookupWindString(xmlDoc.getElementsByTagName('winddir')[0].getAttribute('val'));$('winddirdeg').innerHTML=xmlDoc.getElementsByTagName('winddir')[0].getAttribute('val');$('windspeedmph').innerHTML=xmlDoc.getElementsByTagName('windspeedmph')[0].getAttribute('val');$('windgustmph').innerHTML=xmlDoc.getElementsByTagName('windgustmph')[0].getAttribute('val');$('tempf').innerHTML=xmlDoc.getElementsByTagName('tempf')[0].getAttribute('val');$('baromin').innerHTML=xmlDoc.getElementsByTagName('baromin')[0].getAttribute('val');$('dewptf').innerHTML=xmlDoc.getElementsByTagName('dewptf')[0].getAttribute('val');if($('dewptf').innerHTML==32.0){$('dewptf').innerHTML="n/a";}
if(ageh>0){$('lastupdate').innerHTML=ageh+" hr "+agem+" min "+ages+" sec ago";}else if(agem>0){$('lastupdate').innerHTML=agem+" min "+ages+" sec ago";}else{$('lastupdate').innerHTML=ages+" sec ago";}
if(heatindexf=="-9999"){$('heatindexf').innerHTML="n/a";}else{$('heatindexf').innerHTML=heatindexf+"&deg;F";}
if($('tempf').innerHTML>32){$('dew_label').innerHTML="Dew Point";}else{$('dew_label').innerHTML="Frost Point";}
var wchill=(35.74+ 0.6215*$('tempf').innerHTML- 35.75*Math.pow($('windspeedmph').innerHTML,0.16)+ 0.4275*$('tempf').innerHTML*Math.pow($('windspeedmph').innerHTML,0.16));wchill=Math.round(wchill);wchill=($('windspeedmph').innerHTML<=3)?$('tempf').innerHTML:wchill;wchill=($('tempf').innerHTML>50)?$('tempf').innerHTML:wchill;$('wchill').innerHTML=wchill;if($('dewptf').innerHTML>32){tc=($('tempf').innerHTML- 32)*.556;tdc=($('dewptf').innerHTML-32)*.556;var relhum=Math.round((100.0*(Math.pow((112-(0.1*tc)+tdc)/(112+(0.9*tc)),8)))*10)/10;if(tdc>tc){relhum="100";}
$('relhum').innerHTML=relhum;}else{$('relhum').innerHTML=xmlDoc.getElementsByTagName('humidity')[0].getAttribute('val');}
if($('dewptf').innerHTML=="n/a"){var vl1=(($('tempf').innerHTML- 32)*5.0/9.0);var vl2=((7.5*vl1)/(237.7+ vl1));var vl3=(Math.pow(10.0,vl2));var vps=((6.112*vl3)/33.8653);var vp=(vps*($('relhum').innerHTML/100));var vl4=(Math.log((vp*33.8653)/6.112)/Math.LN10);var vl5=(((237.7*vl4)/(7.5- vl4))*9.0/5.0+ 32.0);$('dewptf').innerHTML=Math.round(vl5*10)/10;}
if(heatindexf<80){var hicolor="#FFFFFF";}
if(heatindexf>79&&heatindexf<90){var hicolor="#FFFF99";}
if(heatindexf>89&&heatindexf<105){var hicolor="#FFCC99";}
if(heatindexf>104&&heatindex<130){var hicolor="#FF9999";}
if(heatindexf>129){var hicolor="#CC99CC";}
if(heatindexf=="-9999"){var hicolor="#FFFFFF";}
hiTable.rows[0].cells[0].style.backgroundColor=hicolor;var beaufort=xmlDoc.getElementsByTagName('beaufort')[0].getAttribute('val');if(beaufort=="0"){var beautxt="(0) Calm";var bcolor="#FFFFFF";}
if(beaufort=="1"){var beautxt="(1) Light air";var bcolor="#FFFFFF";}
if(beaufort=="2"){var beautxt="(2) Light breeze";var bcolor="#99FFCC";}
if(beaufort=="3"){var beautxt="(3) Gentle breeze";var bcolor="#99FF66";}
if(beaufort=="4"){var beautxt="(4) Moderate breeze";var bcolor="#33CC66";}
if(beaufort=="5"){var beautxt="(5) Fresh breeze";var bcolor="#CCCC33";}
if(beaufort=="6"){var beautxt="(6) Strong breeze";var bcolor="#CC9900";}
if(beaufort=="7"){var beautxt="(7) High wind";var bcolor="#CC6600";}
if(beaufort=="8"){var beautxt="(8) Gale";var bcolor="#CC3300";}
if(beaufort=="9"){var beautxt="(9) Strong gale";var bcolor="#FF6633";}
if(beaufort=="10"){var beautxt="(10) Storm";var bcolor="#FF3300";}
if(beaufort=="11"){var beautxt="(11) Violent Storm";var bcolor="#FF0033";}
if(beaufort=="12"){var beautxt="(12) Hurricane";var bcolor="#FF0000";}
beauTable.rows[0].cells[0].style.backgroundColor=bcolor;$('beautxt').innerHTML=beautxt;}
function getWUNDER(){displayWUNDER("ajax.back.php");setTimeout("getWUNDER()",3000);}
