/**
 * 
Open Source License
------------------------------------------------------------------------------------------
Generic Table Editor is licensed under the terms of the Open Source GPL 3.0 license. 

http://www.gnu.org/licenses/gpl.html

Generic Table Editor is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Foobar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

--

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

 * 
 * Generic Table Editor
 *
 * @author Bernhard Woehrlin
 * @copyright (c) 2008-2009, IT.CappuccinoNet.com
 * @date 2009-09-01 16:27:36
 * @version 1.3
 *
 */

/**
 * ########################################################
 *  Start this ExtJS Application
 * ########################################################
 */
Ext.onReady(function(){
    
		// form fields display error messages
		Ext.QuickTips.init();
    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
    FB.log('start application', FB.INFO);
    
		Ext.Ajax.request({
      url: APPL.CONFIG_URL
      ,success: function(response, request){
	      try{
					
          // get the configuration data
					APPL.CONFIG = Ext.util.JSON.decode(response.responseText);
					FB.log("config: "+APPL.CONFIG.data.length);
					
					// load the Grid
	        var application = new APPL.ux.layout.Init({});
					
	         
	      } catch(e) {
	        FB.log('Error on decoding JSON '+e, FB.ERROR);
	      }
    }
    ,failure:function(form, action) {
      FB.log('Error Response on appconf.php data call', FB.DEBUG);

      Ext.Msg.show({
        title:'ERROR'
        ,msg:'Fehler beim Abruf der appConf Daten'
        ,modal:true
        ,icon:Ext.Msg.ERROR
        ,buttons:Ext.Msg.OK
        ,closable:false
      });
    }
    //,params: {}
  });
		
    
		// remove icon Loading..
    var loading = Ext.get('loading');
    loading.setStyle('display', 'none');
    loading.remove();
    
		// render the grid to the specified div in the page
    //grid.render('grid-example');

   

}); // eo function onReady
// eof