var LogInOut = function(){
    // everything in this space is private and only accessible in the HelloWorld block
    
    // define some private variables
    var logDialog, logBtn;
    
    // return a public interface
    return {
        init : function(){
             logBtn = Ext.get('logginout-btn');
             // attach to click event
             logBtn.on('click', this.showDialog, this);
        },
       
        showDialog : function(){
            if(!logDialog){ // lazy initialize the dialogB and only create it once
                logDialog = new Ext.BasicDialog("logginout-dlg", { 
                        autoTabs:true,
                        width:330,
                        height:190,
                        shadow:false,
                        minWidth:330,
                        minHeight:190,
                        proxyDrag: true,
						resizable: false
                });
                //dialogB.addButton('Inserisci', dialogB.addCommento(), dialogB);
            }
            logDialog.show(logBtn.dom);
		}
    };
}();
// using onDocumentReady instead of window.onload initializes the application
// when the DOM is ready, without waiting for images and other resources to load
Ext.onReady(LogInOut.init, LogInOut, true);

Ext.onReady(function(){

    Ext.QuickTips.init();

    // turn on validation errors beside the field globally
    Ext.form.Field.prototype.msgTarget = 'side';
	
    /*
     * ================  Simple form  =======================
     */
    var simple = new Ext.form.Form({
        labelWidth: 75, // label settings here cascade unless overridden
        url:'save-form.php'
    });
    simple.add(
        new Ext.form.TextField({
            fieldLabel: 'Username',
            name: 'username',
            width:175,
            allowBlank:false
        }),

        new Ext.form.TextField({
		    inputType: 'password',
            fieldLabel: 'Password',
            name: 'password',
            width:175
        })
    );
	
//   dialog.addButton('Chiudi', dialog.hide, dialog);
  
   // simple.addButton('Loggin');
   // simple.addButton('Esci');

    simple.render('form-ct');
	
});
