var weatherObj=Class.create();weatherObj.prototype={initialize:function(d,b,a,e){this.id=d;this.weatherbox=$(this.id);this.conditions=new Array;this.day=new Array;this.curday=-1;this.url=b;this.options={idprefix:"w_",imageDir:(a)?a:"ub/images/weather/"};var c=navigator.appVersion.match(/MSIE (\d+\.\d+)/,"");this.isIE=c!=null;this.pngAllowed=this.isIE&&Number(c[1])>=5.5;this.setHashTables();this.injectBehaviors();this.initAjax(e)},setHashTables:function(){var a="";this.wList={cloudy:a+"(bkn[^.]*\\.jpg|ovc[^.]*\\.jpg)$",dust:a+"(dust[^.]*\\.jpg)$",fog:a+"(fg[^.]*\\.jpg|nfg[^.]*\\.jpg)$",freezingrain:a+"(fzra[^.]*\\.jpg|fzrara[^.]*\\.jpg)$",freezingrainsnow:a+"(mix[^.]*\\.jpg)$",funnel:a+"(nsvrtsra[^.]*\\.jpg)$",haze:a+"(mist[^.]*\\.jpg)$",icepellets:a+"(ip[^.]*\\.jpg)$",partlycloudy:a+"(sct[^.]*\\.jpg|few[^.]*\\.jpg)$",rainy:a+"(shra[^.]*\\.jpg|hi_shwrs[^.]*\\.jpg|ra1[^.]*\\.jpg|ra[^.]*\\.jpg)$",rainicepellets:a+"(raip[^.]*\\.jpg)$",rainsnow:a+"(rasn[^.]*\\.jpg)$",smoke:a+"(smoke[^.]*\\.jpg)$",snowy:a+"(sn[^.]*\\.jpg|cold[^.]*\\.jpg)$",sunny:a+"(hot[^.]*\\.jpg|skc[^.]*\\.jpg)$",thunderstorm:a+"(tsra[^.]*\\.jpg|hi_tsra[^.]*\\.jpg)$",wind:a+"(wind[^.]*\\.jpg)$"};this.conditions={cloudy:1,dust:1,fog:1,funnel:1,haze:1,smoke:1,rainy:1,snowy:1,sunny:1,wind:1,rainsnow:1,icepellets:1,partlycloudy:1,rainicepellets:1,thunderstorm:1,freezingrainsnow:1,freezingrain:1}},injectBehaviors:function(){var f=this.weatherbox.style;f.marginLeft="0px";f.width="195px";f.height="150px";f.background='url("'+this.options.imageDir+'weathermain.png")';f.position="relative";if(this.isIE){if(this.pngAllowed){f.background="none";f.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.options.imageDir+"weathermain.png', sizingMethod='scale')"}else{f.background='url("'+this.options.imageDir+'weathermain.gif")'}}var c=document.createElement("a");c.style.position="absolute";c.style.marginTop="130px";c.style.height="10px";c.style.width="195px";c.style.textAlign="center";c.style.fontFamily="Arial";c.style.fontSize="6pt";c.style.color="#FFF";c.innerHTML="Data from NWS";c.href="http://www.weather.gov/";c.target="_blank";this.weatherbox.appendChild(c);var d=5;for(i=0;i<5;i++){var k=document.createElement("div");k.style.position="absolute";k.style.marginTop="60px";k.style.marginLeft=d-3+"px";k.style.fontVariant="small-caps";k.style.fontFamily="Arial";k.style.fontSize="12pt";k.style.fontWeight="bold";k.style.color="#FFF";k.id=this.options.idprefix+"day"+i;this.day["name"+i]=k;this.weatherbox.appendChild(k);var e=document.createElement("div");e.style.position="absolute";e.style.marginTop="82px";e.style.marginLeft=d+4+"px";e.style.width="24px";e.style.height="24px";e.id=this.options.idprefix+"dayico"+i;this.day["ico"+i]=e;this.weatherbox.appendChild(e);var h=document.createElement("div");h.style.position="absolute";h.style.marginTop="104px";h.style.marginLeft=d+"px";h.style.fontFamily="Arial";h.style.fontSize="12pt";h.style.color="#FFF";h.style.width="40px";h.id=this.options.idprefix+"dayhigh"+i;this.day["high"+i]=h;this.weatherbox.appendChild(h);var g=document.createElement("div");g.style.position="absolute";g.style.marginTop="120px";g.style.marginLeft=d+3+"px";g.style.fontFamily="Arial";g.style.fontSize="6pt";g.style.fontWeight="bold";g.style.color="#DDD";g.style.width="40px";g.id=this.options.idprefix+"daylow"+i;this.day["low"+i]=g;this.weatherbox.appendChild(g);d+=40}var a=document.createElement("div");a.style.position="absolute";a.style.marginTop="20px";a.style.marginLeft="130px";a.style.textAlign="right";a.style.width="60px";a.style.height="30px";a.style.fontFamily="Arial";a.style.fontSize="21pt";a.style.color="#FFF";a.id=this.options.idprefix+"MainTemp";this.maintemp=a;this.weatherbox.appendChild(this.maintemp);var j=document.createElement("div");j.style.position="absolute";j.style.marginTop="20px";j.style.marginLeft="12px";j.style.textAlign="right";j.style.width="50px";j.style.height="35px";j.style.fontFamily="Arial";j.style.fontSize="6pt";j.style.color="#FFF";j.id=this.options.idprefix+"MainCond";this.maincond=j;this.weatherbox.appendChild(this.maincond);var b=document.createElement("div");b.style.position="absolute";b.style.marginTop="2px";b.style.marginLeft="65px";b.style.width="64px";b.style.height="64px";b.id=this.options.idprefix+"MainPic";this.weatherbox.appendChild(b);this.setMainPic();this.setTemps()},setMainTemp:function(a){var b=a||0;this.maintemp.innerHTML=b+"&ordm;"},setMainPic:function(a){this.setPic(this.options.idprefix+"MainPic",a)},setPic:function(e,a){var d=a||"";var b=(e==this.options.idprefix+"MainPic")?"large_":"small_";var c=this.options.imageDir+(this.conditions[d]?b+d+".png":"wait.gif");$(e).style.background='transparent url("'+c+'") center center no-repeat';if(c.match(/\.png/i)!=null){if(this.pngAllowed){$(e).style.background="none";$(e).style.width=(b=="large_")?"64px":"24px";$(e).style.height=(b=="large_")?"64px":"24px";$(e).style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+c+"', sizingMethod='scale')"}}return true},processWeather:function(d,a){if(a){for(var b in this.wList){var c=new RegExp(this.wList[b]);if(a.match(c)){return this.setPic(d,b)}}}},setDays:function(){var b=new Date();if(this.curday!=b.getDay()){this.curday=b.getDay();var a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];for(i=0;i<5;i++){this.day["name"+i].innerHTML=a[(i+this.curday)%7]}}},setTemps:function(b){var a=b||[0,0,0,0,0,0,0,0,0,0];for(i=0;i<5;i++){this.day["high"+i].innerHTML=a[i*2]+"&ordm;";this.day["low"+i].innerHTML=a[i*2+1]+"&ordm;"}this.setMainTemp(a[0])},initAjax:function(d){if(d){var a=new Object;if(this.isIE){a.responseXML=new ActiveXObject("Microsoft.XMLDOM");a.responseXML.async="false";a.responseXML.loadXML(d)}else{try{var c=new DOMParser();a.responseXML=c.parseFromString(d,"text/xml")}catch(b){a.responseXML=null}}this.ajaxResponse(a)}else{this.callAjax()}new PeriodicalExecuter(this.callAjax.bindAsEventListener(this),2700)},callAjax:function(){var a=new Ajax.Request(this.url,{method:"get",onSuccess:this.ajaxResponse.bindAsEventListener(this),onFailure:this.error,asynchronous:true})},ajaxResponse:function(e){var d=e.responseXML;var b=[];this.setDays();if(d&&d.getElementsByTagName("dwml").length>0){d=d.getElementsByTagName("dwml")[0].getElementsByTagName("data")[0].getElementsByTagName("parameters")[0];var h=d.getElementsByTagName("temperature");var a=h[0].getElementsByTagName("value");var c=h[1].getElementsByTagName("value");for(i=0;i<a.length;i++){if(a[i].firstChild.nodeValue){b[i*2]=a[i].firstChild.nodeValue}}for(i=0;i<c.length;i++){if(c[i].firstChild.nodeValue){b[i*2+1]=c[i].firstChild.nodeValue}}this.setTemps(b);var g=d.getElementsByTagName("weather")[0].getElementsByTagName("weather-conditions");for(i=0;i<g.length;i++){if(g[i].getAttribute("weather-summary")){this.conditions[i]=g[i].getAttribute("weather-summary")}}this.maincond.innerHTML=this.conditions[0];var f=d.getElementsByTagName("conditions-icon")[0].getElementsByTagName("icon-link");for(i=0;i<f.length;i++){if(i==0){this.processWeather(this.options.idprefix+"MainPic",f[i].firstChild.nodeValue)}this.processWeather(this.options.idprefix+"dayico"+i,f[i].firstChild.nodeValue)}}},error:function(a){}};