(function(){if(typeof window.spWeather==="undefined")window.spWeather=new function(){var url=window.webContext+"/RWeatherService/";this.CityWeather=function(cityId,cityName){this.city={id:cityId,name:cityName};this.forecasts=[]};this.translators={};this.load=function(cityId,renderer,error){window.sp.ajaxRequest(url).withParam("city",cityId).send().then(function(request){var weatherService=request.getResponseHeader("X-WeatherService");if(spWeather.translators[weatherService]){var cityWeather=spWeather.translators[weatherService].translate(request.responseAsJson());
if(typeof renderer==="function")renderer(cityWeather);else console.log("ERROR spWeather: no renderer of weather data specified!")}else console.log("ERROR spWeather: no data translator for weather service: ",weatherService)},function(){if(error)error()})};this.iconBaseUrl=window.webContext+"/look/jsp/imgDesign/meteo/"}})();