/*!
 * Ext JS Library 3.1.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */

window.formPanels = [];
window.userVariables = [];

// Sample desktop configuration
MyDesktop = new Ext.app.App
({
    init :function()
    {

	},
    getAutorun: function() /** These get initialized AFTER a successful login **/
    {
        var ret = [];
        ret[0] = new this.embeddedBrowser();
        ret[1] = new this.chat();

        return ret;
    },
    getHiddenModules: function() /** These get loaded but don't show up on the start menu (needed for items that exist in submenus **/
    {
        var ret = [
            new this.starocean4(),
            /*
            new this.knichel(),
            new this.knichelDebug(),
            new this.knichelResults(),
            new this.knichelStatus()*/
        ];

        return ret;
    },
    getLogin: function()
    {
        var ret = [];
        ret[0] = new this.login();

        return ret;
    },
	getModules : function()
    {
        return [
            new this.workMenu(),
            new this.gameMenu(),
            new this.googleChat(),
            new this.ventStatus(),
            new this.memberList(),
            new this.recipePlanner(),
            new this.worldMaps(),
            /*

            new MyDesktop.TabWindow(),
            new MyDesktop.AccordionWindow(),
            new MyDesktop.BogusMenuModule(),
            new MyDesktop.BogusModule(),
            */

		];
	},
    // config for the start menu
    getStartConfig : function()
    {
        return {
            title     : 'Web Development',
            iconCls   : 'user',
            toolItems :
            [
                {
                    text:'Settings',
                    iconCls:'settings',
                    scope:this
                },'-',
                {
                    text:'Logout',
                    iconCls:'logout',
                    scope:this,
                    handler: function()
                    {
                        var now = new Date();
                        var exdate = new Date(now.getTime() - 1000*60*60*24*7);

                        Ext.util.Cookies.set('username','', exdate);
                        location.reload();
                    }
                }
            ]
        };
    }
});

MyDesktop.chat            = window.modules.chat;
MyDesktop.debugServer     = window.modules.debugServer;
MyDesktop.embeddedBrowser = window.modules.embeddedBrowser;
MyDesktop.googleChat      = window.modules.googleChat;
MyDesktop.knichel         = window.modules.knichel;
MyDesktop.knichelDebug    = window.modules.knichelDebug;
MyDesktop.knichelResults  = window.modules.knichelResults;
MyDesktop.knichelStatus   = window.modules.knichelStatus;
MyDesktop.login           = window.modules.login;
MyDesktop.memberList      = window.modules.memberList;
MyDesktop.worldMaps       = window.modules.worldMaps;
MyDesktop.recipePlanner   = window.modules.recipePlanner;
MyDesktop.starocean4      = window.modules.starocean4;
MyDesktop.ventStatus      = window.modules.ventStatus;

/*
 * Example windows
 */
    MyDesktop.gameMenu = Ext.extend(window.modules.BogusModule,
    {
        init : function(){
            this.launcher = {
                text: 'Game Modules',
                iconCls: 'folder',
                handler: function() {
                    return false;
                },
                menu:
                {
                    items:
                    [
                        {
                            text: 'Star Ocean 4',
                            iconCls:'icon-starocean4',
                            handler : function()
                            {
                                MyDesktop.getModule('starocean4').createWindow();
                            }
                        }
                    ]
                }
            }
        }
    });

    MyDesktop.workMenu = Ext.extend(window.modules.BogusModule,
    {
        init : function(){
            this.launcher = {
                text: 'Work Testing Stuff',
                iconCls: 'folder',
                handler: function() {
                    return false;
                },
                menu:
                {
                    items:
                    [
                        /*
                        {
                            text: 'Knichel Logistics',
                            iconCls:'icon-bogus',
                            handler : function()
                            {
                                MyDesktop.getModule('knichel').createWindow();
                                //MyDesktop.getModule('knichelDebug').createWindow();
                            }
                        }*/
                    ]
                }
            }
        }
    });


window.modules = undefined;
Ext.onReady(function()
{
    /*
    if (getCookie('derm_login'))  /** If they're still under a cookie timer, this will keep them from relogging on an accidental refresh **
    {
        userFunctions.userData('n', callbacks);
    }*/
    setTimeout(function()
    {
        Ext.get('loading').remove();
        Ext.get('loading-mask').fadeOut({remove:true});
    }, 500);
}, this, {single:true});

