Weather = Class.create();
Object.extend(Weather.prototype, WebControl.prototype);

Object.extend(Weather.prototype,
    {
        initialize : function(config)
        {
            WebControl.prototype.initialize.call(this, config);
            var thisClass = this;
            
            this.config.Show = function()
            {
                var weatherData = ActionHandler.GetResponse(
                {
                    url: "Components/Weather/WeatherActionHandler.php",
                    action: "GetWeatherData"
                });
                
                if(!Object.isUndefined(weatherData.src))
                {
                    var topLine = new Element("div"); topLine.className = "topLine"; topLine.innerHTML = '<span id="weatherCity">'+weatherData.city+'</span>';
                    var image = new Element("img"); image.src = weatherData.src;
                    var label = new Element("h6");  label.update(weatherData.celsius + " &#176;C");
                    var bottomLine = new Element("div"); bottomLine.className = "bottomLine"; bottomLine.innerHTML = '<a href="http://idojaras.comfy.hu/" target="_blank">Időjárás kereső</a>';
                }
                else
                {
                    var image = new Element("img"); image.src = "";
                    var label = new Element("h6");  label.update("");
                }
                
                $(thisClass.config.container).insert(topLine);
                $(thisClass.config.container).insert(image);
                $(thisClass.config.container).insert(label);
                $(thisClass.config.container).insert(bottomLine);
            }
        }
    }
);
