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

	getModules : function(){
		return [
			new MyDesktop.DescriptionWindow(),
			new MyDesktop.LookWindow(),
			new MyDesktop.GetModule(),
			new MyDesktop.BonusWindow(),
			new MyDesktop.VideoWindow(),
			new MyDesktop.RenewWindow(),
			new MyDesktop.DownloadWindow()
		];
	},

    // config for the start menu
    getStartConfig : function(){
        return {
            title: 'Гость',
            iconCls: 'user',
            toolItems: [{
                text:'Settings',
                iconCls:'settings',
                scope:this
            },'-',{
                text:'Logout',
                iconCls:'logout',
                scope:this
            }]
        };
    }
});

MyDesktop.DescriptionWindow = Ext.extend(Ext.app.Module, {
    id:'description-win',
    init : function(){
        this.launcher = {
            text: 'Описание',            
			iconCls:'tabs',
            handler : this.createWindow,
            scope: this
        }
    },

    createWindow : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('description-win');
        if(!win){
            win = desktop.createWindow({
                id: 'description-win',
                title:'Описание',
                width:"80%",
                height:600,
                iconCls: 'tabs',
                shim:false,
                animCollapse:false,
                border:false,
                constrainHeader:true,

                layout: 'fit',
                items:
                    new Ext.TabPanel({
                        activeTab:0,

                        items: [{
							title: 'Описание',                            							
							header:false,
							autoLoad:'description.php',
							border:false,
							autoScroll: true
                        },{
                            title: 'Лицензия',
							header:false,
							autoLoad:'lic.php',
							border:false,
							autoScroll: true
                        }]
                    })
            });
        }
        win.show();
    }
});



MyDesktop.LookWindow = Ext.extend(Ext.app.Module, {
    id:'look-win',
    init : function(){
        this.launcher = {
            text: 'Как выглядит',
            iconCls:'tabs',
            handler : this.createWindow,
            scope: this
        }
    },

    createWindow : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('look-win');
        if(!win){
            win = desktop.createWindow({
                id: 'look-win',
                title:'Как выглядит',
                width:850,
                height:632,
                iconCls: 'tabs',
                shim:false,
                animCollapse:false,
                border:false,
                constrainHeader:true,

                layout: 'fit',
                items:
                    new Ext.TabPanel({
                        activeTab:0,

                        items: [{
                            title: 'Скрин 1',
                            header:false,
                            html : '<img src=screen1.png>',
                            border:false
                        },{
                            title: 'Скрин 2',
                            header:false,
                            html : '<img src=screen2.png>',
                            border:false
                        },{
                            title: 'Скрин 3',
                            header:false,
                            html : '<img src=screen3.png>',
                            border:false
                        },{
                            title: 'Скрин 4',
                            header:false,
                            html : '<img src=screen4.png>',
                            border:false
                        },{
                            title: 'Скрин 5',
                            header:false,
                            html : '<img src=screen5.png>',
                            border:false
                        },{
                            title: 'Пакетка',
                            header:false,
                            html : '<img src=screen6.png>',
                            border:false
                        }]
                    })
            });
        }
        win.show();
    }
});

MyDesktop.GetModule = Ext.extend(Ext.app.Module, {
    id:'get-win',
    init : function(){
        this.launcher = {
            text: 'Как получить',
            iconCls:'bogus',
            handler : this.createWindow,
            scope: this
        }
    },

    createWindow : function(src){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('get-win');
        if(!win){
            win = desktop.createWindow({
                id:'get-win',
                title:'Контакты',
                width:500,
                height:230,
				bodyStyle: 'background:white;', 
                html : '<div id="description-div" style="font-size:14pt; padding:30px 50px"><p>Контакты:</p><div style="padding-left:70px;padding-top:10px"><img style="margin-bottom:-5px" src="wp-content/uploads/icq_gif.gif" height=18 width=17> 407567594<br /><img style="margin-bottom:-5px" src="wp-content/uploads/email.jpg" height=18 width=18> feed@pandoraboxx.ru</div></div>',
                iconCls: 'bogus',
                shim:false,
                animCollapse:false,
                constrainHeader:true
            });
        }
        win.show();
    }
});

MyDesktop.BonusWindow = Ext.extend(Ext.app.Module, {
    id:'gift-win',
    init : function(){
        this.launcher = {
            text: 'Бонусы',
            iconCls:'tabs',
            handler : this.createWindow,
            scope: this
        }
    },

    createWindow : function(src){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('gift-win');
        if(!win){
            win = desktop.createWindow({
                id:'gift-win',
                title:'Бонусы',
                width:600,
                height:400,
				bodyStyle: 'background:white;', 
                html : '<div id="description-div" style="font-size:14pt; padding:20px"><p><strong>Бонус №1</strong>: После получения программы Вам также достается <a href="http://topperharley.ru/2010/02/parser-yandeks-kartinok/">парсер картинок яндекса</a>.</p><p><strong>Бонус №2</strong>: После получения программы Вам также достается <a href="http://topperharley.ru/2010/02/parser-youtube-yutuba/ ">парсер YOUTUBE</a>.</p><p><strong>Бонус №3</strong>: <a href="http://topperharley.ru/2010/08/upload-manager/">Менеджер загрузки</a>, позволяющий заливать сайты по FTP через SOCKS5 пофайлово или архивами с последующей распаковкой.</p><p><strong>Бонус №4</strong>: <a href="/update/PandoraMacros.zip">Плагин с макросами</a> для редактора <a href="http://notepad-plus-plus.org/download">Notepad++</a>, который значительно упрощает работу с шаблонами и освоение программы(описание внутри).</p></div>',
                iconCls: 'bogus',
                shim:false,
                animCollapse:false,
                constrainHeader:true
            });
        }
        win.show();
    }
});



MyDesktop.VideoWindow = Ext.extend(Ext.app.Module, {
    id:'video-win',
    init : function(){
        this.launcher = {
            text: 'Видео',
            iconCls:'tabs',
            handler : this.createWindow,
            scope: this
        }
    },

    createWindow : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('video-win');
        if(!win){
            win = desktop.createWindow({
                id:'video-win',
                title:'Видео',
                width:550,
                height:360,
				bodyStyle: 'background:white;', 
				autoLoad:'video.php',                
                iconCls: 'tabs',
                shim:false,
                animCollapse:false,
                constrainHeader:true
            });		           
        }
        win.show();
    }
});

MyDesktop.RenewWindow = Ext.extend(Ext.app.Module, {
    id:'renew-win',
    init : function(){
        this.launcher = {
            text: 'Новый ключ',
            iconCls:'tabs',
            handler : this.createWindow,
            scope: this
        }
    },

    createWindow : function(src){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('renew-win');
        if(!win){
            win = desktop.createWindow({
                id:'renew-win',
                title:'Новый ключ',
                width:500,
                height:390,
				bodyStyle: 'background:white;', 
				autoLoad:'update/renew.php',                
                iconCls: 'bogus',
                shim:false,
                animCollapse:false,
                constrainHeader:true
            });
        }
        win.show();
    }
});


MyDesktop.DownloadWindow = Ext.extend(Ext.app.Module, {
    id:'download-win',
    init : function(){
        this.launcher = {
            text: 'Скачать',
            iconCls:'tabs',
            handler : this.createWindow,
            scope: this
        }
    },

    createWindow : function(src){			
        var desktop = this.app.getDesktop();	
        var win = desktop.getWindow('download-win');
        if(!win){
            win = desktop.createWindow({
                id:'download-win',
                title:'Скачать',
                width:450,
                height:220,
				bodyStyle: 'background:white;', 
				autoLoad:'update/links.php',                
                iconCls: 'bogus',
                shim:false,
                animCollapse:false,
                constrainHeader:true
            });
        }
        win.show();
    }
});

Ext.onReady(function() {
    var win = new Ext.Window({
		id:'discount-win',
		title:'Скидка!',
		width:700,
		height:300,
/*
		width:440,
		height:200,
		*/
		bodyStyle: 'background:white;', 
		autoLoad:'discount.php',                
		iconCls: 'bogus',
		shim:false,
		animCollapse:false,
		constrainHeader:true           
    });
    win.show(); 
});

