/*
 * Ext JS Library 2.2.1
 * Copyright(c) 2006-2009, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */


// Sample desktop configuration

MyDesktop = new Ext.app.App({
	init :function(){
		Ext.QuickTips.init();
		
		Ext.onReady(function(){
			// Carrega literals
	    	scrs=['menu/lit/'+VG_idioma+'/lit_menu.js'];// Literals a carregar
			cargados=0;
			loadScript();
	    	var int=setInterval(function(){
	    			if(scrs.length==cargados){   			
	    				clearInterval(int);
	    			}
	    		},200
	    	)
	    	// Fi carrega literals
		});
	},

	getModules : function(){
		return [
			new MyDesktop.ClubMenuModule(),
			new MyDesktop.ForosMenuModule(),
			new MyDesktop.MenuMultimedia(),
			new MyDesktop.XatMenuModule()
		];
	},

    // config for the start menu
    getStartConfig : function(){
        return {
            title: lit_desconnectat,
            iconCls: 'offline' /*,
            toolItems: [{
                text:lit_alta_users,
                iconCls:'altamembre',
                scope:this,
                handler:usuaris
                
            },'-',{
                text:lit_menu_login,
                iconCls:'login',
                scope:this
            }]
            */
        };
    }
});



/*
 * Example windows
 */
 
var windowIndex = 0;

// CLUB
MyDesktop.ClubMenuModule = Ext.extend(Ext.app.Module, {
    init : function(){
        this.launcher = {
            text: lit_club,
            iconCls: 'membres',
            handler: function() {
				return false;
			},
            menu: {
                items:[{
                    text: lit_quisom,
                    iconCls:'quisom',
                    handler : this.quisom,
                    scope: this,
                    windowId: windowIndex
                    },{
                    text: lit_estatuts,
                    iconCls:'estatuts',
                    handler : this.estatuts,
                    scope: this,
                    windowId: windowIndex
                    },{
                    text: lit_samarretes,
                    iconCls:'samarretes',
                    handler : this.creaSamarretes,
                    scope: this,
                    windowId: 'samarretes'
                    }]
            }
        }
    },
    
    
      creaSamarretes : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('samarretes');
        if(!win){
            win = desktop.createWindow({
                id: 'samarretes',
                title: lit_samarretes,
                width:600,
                height:500,
                iconCls: 'samarretes',
                shim:false,
                animCollapse:false,
                border:false,
                constrainHeader:true,
                autoLoad:'samarretes/samarretas_loading.html'
 			});
        }
        win.show();
    },
    
    estatuts : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('estatuts');
        if(!win){
            win = desktop.createWindow({
                id: 'estatuts',
                title: lit_estatuts,
                width:700,
                height:500,
                iconCls: 'estatuts',
                shim:false,
                animCollapse:false,
                border:false,
                constrainHeader:true,
                autoLoad:'estatuts/estatuts_loading.html'
 			});
        }
        win.show();
    },
    quisom : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('quisom');
        if(!win){
            win = desktop.createWindow({
                id: 'quisom',
                title: lit_quisom,
                width:700,
                height:500,
                iconCls: 'quisom',
                shim:false,
                animCollapse:false,
                border:false,
                constrainHeader:true,
                autoLoad:'quisom/quisom_loading.html'
 			});
        }
        win.show();
    }
    
});

// FI CLUB



// FOROS

MyDesktop.ForosMenuModule = Ext.extend(Ext.app.Module, {
    init : function(){
        this.launcher = {
            text: lit_foros,
            iconCls: 'forum',
            scope: this,
            windowId: 'foros',
            handler: this.forosVan
        }
    },
    
    
      forosVan : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('foros');
        if(!win){
            win = desktop.createWindow({
                id: 'foros',
                title: lit_foros,
                width:1000,
                height:600,
                activeTab:0,
                iconCls: 'forum',
                shim:false,
                animCollapse:false,
                border:false,
                constrainHeader:true,
                autoLoad:'foros/foros.php'
 			});
        }
        win.show();
    }
});

// FI FOROS


// XAT

MyDesktop.XatMenuModule = Ext.extend(Ext.app.Module, {
    init : function(){
        this.launcher = {
            text: lit_xat,
            iconCls: 'xat',
            scope: this,
            windowId: 'xat',
            handler: this.funcXat
        }
    },
    
    
      funcXat : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('xat');
        if(!win){
            win = desktop.createWindow({
                id: 'xat',
                title: lit_xat,
                width:800,
                height:600,
                activeTab:0,
                iconCls: 'xat',
                shim:false,
                animCollapse:false,
                border:false,
                constrainHeader:true,
                autoLoad:'xat/xat_loading.php'
 			});
        }
        win.show();
    }
});

// FI XAT



// MULTIMEDIA
MyDesktop.MenuMultimedia = Ext.extend(Ext.app.Module, {
    init : function(){
        this.launcher = {
            text: lit_multimedia,
            iconCls: 'multimedia',
            handler: function() {
				return false;
			},
            menu: {
                items:[{
                    text: lit_tv_radio,
                    iconCls:'tv',
                    handler : this.creaTv,
                    scope: this,
                    windowId: 'tv'
                    }]
            }
        }
    },
      creaTv: function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('tv');
        if(!win){
            win = desktop.createWindow({
                id: 'tv',
                title: lit_tv_radio,
                width:1100,
                height:470,
                iconCls: 'tv',
                shim:false,
                animCollapse:false,
                border:false,
                constrainHeader:true,
                autoLoad:'multimedia/tv_loading.html'
 			});
        }
        win.show();
    }
    
});

// FI MULTIMEDIA



