
var weather_regular=$.inherit(Module,{__constructor:function(div){this.__base(div);this.type="weather_regular";},initialize:function(){this.loadWeatherValues();},loadModuleCallback:function(data,textStatus){this.container[0].innerHTML=data.html;this.loadWeatherValues();this.addDragHandle(data);this.appropriatelySizeModule();this.manageModuleMargins();},loadWeatherValues:function(){var _this=this;var options={'a':'getWeatherValues','m':this.id};this.ajaxPost('getWeatherValues',{},function(data){var weatherData=eval('('+data.response+')');var thisLocation=weatherData.location.city+', '+((weatherData.location.country=='United States')?weatherData.location.region:weatherData.location.country);if(weatherData.error){$('*',_this.container).hide();$('<div class="errordiv">div>').html("Can't find "+thisLocation).prependTo(_this.container);}
else{var current=weatherData.current;var sevendays=weatherData.sevendays;var units=weatherData.units;$('#weatherLocation',_this.container).html(thisLocation);$('.temperatureUnits',_this.container).html(units.temperature);$('.speedUnits',_this.container).html(units.speed);$('.distanceUnits',_this.container).html(units.distance);$('.icon',_this.container).html('<img src="/adm/images/modules/weather_regular/icons/'+weatherData.current.icon.replace('.jpg','.png')+'" />');$('#temperatureValue',_this.container).html(current.temperature);$('#sunriseValue',_this.container).html(weatherData.sunrise);$('#sunsetValue',_this.container).html(weatherData.sunset);$('#currentConditionsValue',_this.container).html(_this.ucwords(current.icon.replace(/_/g,' ').replace('.jpg','').replace(/night/i,'')));$('#whighValue',_this.container).html(sevendays[0].high);$('#wlowValue',_this.container).html(sevendays[0].low);$('#humidityValue',_this.container).html(current.relative_humidity+'%');$('#cloudCoverValue',_this.container).html(current.cloud_cover+'%');$('#visibilityValue',_this.container).html(current.visibility);$('#UVIndexValue',_this.container).html(current.uv+' - '+current.uv_words);$('#windValue',_this.container).html(current.wind_speed);$('#dewPointValue',_this.container).html(current.dew_point);$('#lastUpdatedValue',_this.container).html(weatherData.last_modified);}});},ucwords:function(str){return(str+'').replace(/^([a-z])|\s+([a-z])/g,function($1){return $1.toUpperCase();});}});
