


(function($, undefined) {

    $.widget("ui.EprojectEventi", {
        options: {
		evento_url_text:'Vai al sito dell\'evento.'
    }
      ,
	
    id: '',
    index: 0,
    _create: function() {

        this.id = this.element[0].id;
        this.renderControl();
    }


       ,
    renderControl: function() {

        var widget = this;
        // this.element.removeClass();
        this.element.html('');
        for (var j in eventi.Children) {
            var evento = eventi.Children[j];
            if(evento.Titolo){
            var li = $('<li>' +
                      '<img src="../' + evento.Immagine + '">' +
                      '<p><span class="dataEvento">' + evento.Data + '</span><br>' +
                      '<span class="titoloEvento">' + evento.Titolo + '</span><br>' +
                     (evento.Note == '' ? '' : '<span class="noteEvento">' + evento.Note + '</span></p>') +
                      '<p>' + evento.Abstract + '</p>' +
                      '<a href="' + evento.Url + '" target="_blank" class="linkBlock">'+this.options.evento_url_text+'</a>' +
              		  '</li>');
            this.element.append(li);
			}
        }

    }


        , destroy: function() {
            this.element.html('');
            this.element.removeClass();
            $.Widget.prototype.destroy.apply(this, arguments);
        },
    value: function(newValue) {
        if (newValue === undefined) {
            return this._value();
        }


        this._setOption("value", newValue);
        return this;
    },

    _setOption: function(key, value) {
        if (key === "value") {
            this.options.value = value;
            this._refreshValue();
            this._trigger("change");
            if (this._value() === this.max) {
                this._trigger("complete");
            }
        }

        $.Widget.prototype._setOption.apply(this, arguments);
    },

    _value: function() {

    },

    _refreshValue: function() {

    }


});

$.extend($.ui.EprojectEventi, {
    version: "@VERSION"
});

}

)(jQuery);









(function($, undefined) {

    $.widget("ui.EprojectEventiHP", {
        options: {

    }
      ,

    id: '',
    index: 0,
    _create: function() {

        this.id = this.element[0].id;
        this.renderControl();
    }


       ,
    renderControl: function() {

        var widget = this;
        // this.element.removeClass();
        this.element.html('');

        if (this.index >= eventi.Children.length)
            this.index = 0;
        var event = eventi.Children[this.index];

        this.element.hide();

        if (!event) return;
        this.element.html('<img src="' + event.Immagine + '">' +
        	    '<h5>' + event.Titolo + '</h5>' +
        	    '<p class="date">' + event.Data + '</p>' +
        	    '<p>' + event.Abstract + '</p>');

        this.element.fadeIn('slow', function() {
            setTimeout(function() {

                widget.FadeOut(widget)
            }, 5000);
        });

    }

        , FadeOut: function(widget) {
            //var widget = this;
            widget.index++;

            widget.element.fadeOut('slow', function() {
                widget.renderControl();
            });

        }

        , destroy: function() {
            this.element.html('');
            this.element.removeClass();
            $.Widget.prototype.destroy.apply(this, arguments);
        },
    value: function(newValue) {
        if (newValue === undefined) {
            return this._value();
        }


        this._setOption("value", newValue);
        return this;
    },

    _setOption: function(key, value) {
        if (key === "value") {
            this.options.value = value;
            this._refreshValue();
            this._trigger("change");
            if (this._value() === this.max) {
                this._trigger("complete");
            }
        }

        $.Widget.prototype._setOption.apply(this, arguments);
    },

    _value: function() {

    },

    _refreshValue: function() {

    }


});

$.extend($.ui.EprojectEventiHP, {
    version: "@VERSION"
});

}

)(jQuery);


