Proto.UI.widget=Class.create({
        initialize: function() 
        {
          
        this.options = Object.extend({
                className:'Proto_widget',
                container:document.body,
                element:false,
                url:false,
                html:"&nbsp;",
                title:"&nbsp;",
                closable:true,
                onclose:function(){},
                closeEffect:Effect.Puff,
                openEffect:Element.show
                }, arguments[0] || { });
          this.create();
        },
        create:function()
        {
            this.container = new Element("div",{'class':this.options.className});
            this.options.container.insert(this.container);
              this.container.hide();
            
            this.title = new Element("div",{'class':this.options.className+"-title"});
            this.container.insert(this.title);
            this.closebox = new Element("div",{'class':this.options.className+"-close"});
            this.container.insert(this.closebox);
            this.content = new Element("div",{'class':this.options.className+"-content"});
            this.container.insert(this.content);

            this.title.update(this.options.title);
            this.closebox.observe("click",this.close.bind(this));
            if(typeof this.options.url=="string")
              {
            new Ajax.Updater(this.content, this.options.url);
              }
            else
              {
            if(typeof this.options.element=="object")
              {
                this.content.update(this.options.element.innerHTML);
                this.options.element.remove();//?
              }
              else
              {
                this.content.update(this.options.html);
              }
              }
            this.options.openEffect(this.container,{
            duration:0.5
            });
            
        },
        close:function()
        {
            this.options.closeEffect(this.container,{
            duration:0.5,
            afterFinish:function(){
                  this.options.onclose();
                  this.container.remove();}.bind(this)
            });
            
        }
    })