// JavaScript Document
var LogInOutC = function(){
    // everything in this space is private and only accessible in the HelloWorld block
    
    // define some private variables
    var logDialogC, logBtnC;
    
    // return a public interface
    return {
        init : function(){
             logBtnC = Ext.get('logginout-btn-commento');
             // attach to click event
             logBtnC.on('click', this.showDialog, this);
        },
       
        showDialog : function(){
            if(!logDialogC){ // lazy initialize the dialogB and only create it once
                logDialogC = new Ext.BasicDialog("logginout-dlg-commento", { 
                        autoTabs:true,
                        width:330,
                        height:190,
                        shadow:false,
                        minWidth:330,
                        minHeight:190,
                        proxyDrag: true,
						resizable: false
                });
                //dialogB.addButton('Inserisci', dialogB.addCommento(), dialogB);
            }
            logDialogC.show(logBtnC.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(LogInOutC.init, LogInOutC, true);

Ext.onReady(function(){

    Ext.QuickTips.init();

    // turn on validation errors beside the field globally
    Ext.form.Field.prototype.msgTarget = 'side';

    /*
     * ================  Simple form  =======================
     */
    var simpleC = new Ext.form.Form({
        labelWidth: 75, // label settings here cascade unless overridden
        url:'save-form.php'
    });
    simpleC.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
        })
    );

    simpleC.render('form-ct-commento');
});
