MyDesktop = new Ext.app.App({
	init :function(){
		Ext.QuickTips.init();
	},

	getModules : function(){
		return [
            new MyDesktop.TabWindow(),
            new BogusMenuModule(),
            //new MyDesktop.BogusModule(),
            new BogusModule(),
            new MyDesktop.DownloadModule(),
            new MyDesktop.NewsModule()
		];
	},

    // config for the start menu
    getStartConfig : function(){
        return {
            title: 'General Howard Motors Mills',
            iconCls: 'user',
            toolItems: [{
                text:'E-Mail',
                iconCls:'email',
                scope:this
            },{
                text:'Pictures',
                iconCls:'pictures',
                scope:this
            },{
                text:'RSS Feed',
                iconCls:'rss',
                scope:this,
                handler: function() {
                    window.open("http://feeds2.feedburner.com/TeamB","_new");
                }
            },'-',{
                text:'Logout',
                iconCls:'logout',
                scope:this,
                handler: function() {
                    window.location='http://www.johosaphats.com';
                }
            }]
        };
    }
});

// for example purposes
var windowIndex = 0;

MyDesktop.DownloadModule = Ext.extend(Ext.app.Module, {
    init : function(){
        this.launcher = {
            text: 'Downloads',
            iconCls:'download',
            handler : this.createWindow,
            scope: this,
            windowId:windowIndex
        }
    },

    createWindow : function(src){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('bogus'+src.windowId);
        if(!win){
            win = desktop.createWindow({
                id: 'bogus'+src.windowId,
                title:src.text,
                width:750,
                height:480,
                //autoLoad: {url: 'http://teambcomic.com/comic.php',scripts:false},
                html : 'Downloads coming soon!',
                iconCls: 'download',
                shim:false,
                animCollapse:false,
                constrainHeader:true,
                autoScroll: true
            });
        }
        win.show();
    }
});


MyDesktop.NewsModule = Ext.extend(Ext.app.Module, {
    init : function(){
        this.launcher = {
            text: 'Latest News',
            iconCls:'news',
            handler : this.createWindow,
            //handler: showWarning,
            scope: this,
            windowId:windowIndex
        }
    },
    createWindow : function(src){
        Ext.MessageBox.alert('Coming Soon','We\'ll have news coming soon!');
    }
});

Ext.onReady(function() {
var welcomeWin = MyDesktop.getDesktop().createWindow({
	id: 'bogus99',
	title:'News',
	width:250,
	height:150,
	html : 'Welcome to our new site. We\'re still working out some bugs, and adding features.  We\'d love to hear your feedback at <b>jack.spratt</b> at <b>teambcomic</b> dot <b>com</b> while you\'re waiting for us to get off our lazy butts and write new comics.',
	iconCls: 'news',
	shim:false,
	animCollapse:false,
	constrainHeader:true,
	autoScroll: true,
	x: '75%',
	shadow: false,
});
welcomeWin.show();
});

