/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.onReady(function(){
    
	var simple = new Ext.FormPanel({
        labelWidth: 45, // label settings here cascade unless overridden
		renderTo:'formlogin',
        frame: true,
        title: '&Aacute;rea Restrita',
        bodyStyle: 'padding:5px 5px 0 0',
        width: 189,
        defaults: {width: 120},
        defaultType: 'textfield',
		//baseCls:'ext-all2.css',
		 buttons: [{
            text: 'Entrar',
			 handler: function(){
				simple.getForm().submit({
											url:'logar.php',
											waitMsg:'Logando...',
											success:function(form,action){
												//window.location = "http://www.google.com/";
												
												//alert(action.result.results);
												if(action.result.results==1)
													window.location='netcom_geracad/area_aluno.php';
												if(action.result.results==2)
													window.location='netcom_geracad/area_professor.php';
											},
											failure:function(form,action){
												alert('Erro ao realizar acesso\nLogin ou Senha inválido');
											}
										
										});
			}

			
        }],

        items: [
             {
            	xtype: 'textfield',
            	fieldLabel: 'Login',
            	name: 'login',
				allowBlank:false,
				blankText:'Necessário inserir seu login'
            	
            	
            },
            {
            	xtype: 'textfield',
            	fieldLabel: 'Senha',
            	name: 'senha',
				inputType: 'password'
				//vtype: 'password'

            }
			
        ]
    });
	

    // second tabs built from JS
    var tabs2 = new Ext.TabPanel({
        renderTo: 'tabs',
        activeTab: 0,
        //width:600,
        height:200,
        plain:true,
        defaults:{autoScroll: true},
        items:[{
                title: 'São Luís',
                autoLoad:'tabs.php?cidade=1'

            },{
                title: 'Imperatriz',
                autoLoad:'tabs.php?cidade=2'
            }
        ]
    });

    function handleActivate(tab){
        alert(tab.title + ' was activated.');
    }
});