var DescriptionManagerWidget = new Class({

	//costruttore, assegno le variabili necessarie
    /**
     * container == elemnto in cui andrà il blocco descrizione
     * */
	initialize: function(container) {
		this.container = container;
        this.p = $('description_p');
        this.text = $('description_txt');
        this.img = new Element('div');
        this.img.inject(this.container);
	},
	//ricevo oggetto, proprietà text e image, mostro a schermo
    manageResult:function(desc){
        this.text.set('text',desc.text);
        if (this.p.hasClass('empty')) {
            this.p.removeClass('empty');
        }
        this.img.dispose();
        
        if(desc.image.length > 0){
            this.img = new Element('img',{'src':desc.image});
        }else{
            this.img = new Element('div');
        }
        
        this.img.inject(this.container);
    },
    //ripulisco il container
    clean:function(){
        this.text.set('text','');
        this.p.addClass('empty');
        this.img.dispose();
    }
});
