Ext.BLANK_IMAGE_URL = 'images/s.gif';

var windowIndex = 0;
var tutNewAccountWindow, tutOutlookWindow, tutOutExpWindow, tutFilezillaWindow, tutThunderWindow;

MyDesktop = new Ext.app.App({
    init: function() {
        Ext.QuickTips.init();
    },
    getModules: function() {
        //Tutoriales que van como acceso directos en submenus del menú "inicio"
        tutNewAccountWindow = new MyDesktop.TutNewAccountWindow();
        tutOutlookWindow = new MyDesktop.TutOutlookWindow();
        tutOutExpWindow = new MyDesktop.TutOutExpWindow();
        tutFilezillaWindow = new MyDesktop.TutFilezillaWindow();
        tutThunderWindow = new MyDesktop.TutThunderWindow();

        //Accesos directos del menú "inicio"
        return [
new MyDesktop.WeWindow(),
new MyDesktop.ServicesWindow(),
new MyDesktop.ContactWindow(),
new MyDesktop.HostingWindow(),
new MyDesktop.FeedWindow(),
new MyDesktop.ClientsWindow(),
new MyDesktop.TutorialsWindow(),
new MyDesktop.GlossaryWindow(),
new MyDesktop.CoursesWindow(),
new MyDesktop.DownloadsWindow()
];
    },

    // configuración del menu de inicio
    getStartConfig: function() {
        return {
            title: resTitle,
            iconCls: 'scientia',
            toolItems: [{
                text: resAdministrate,
                iconCls: 'admin-sm',
                scope: this,
                handler: function() { soundManager.play('newwindow'); window.open('http://admin.scientia.com.ar') }
            }, {
                text: 'Webmail',
                iconCls: 'webmail-sm',
                scope: this,
                handler: function() { soundManager.play('newwindow'); window.open('http://mail.scientia.com.ar') }
            }, '-', {
                text: resForum,
                iconCls: 'forum-sm',
                scope: this,
                handler: function() { soundManager.play('newwindow'); window.open('http://foro.scientia.com.ar') }
            }, {
                text: resBlog,
                iconCls: 'blog-sm',
                scope: this,
                handler: function() { soundManager.play('newwindow'); window.open('http://www.programandoamedianoche.com') }
}]
            };
        }
    });

    /*
    * Windows
    */

    //Nosotros
    MyDesktop.WeWindow = Ext.extend(Ext.app.Module, {
        id: 'we-win',
        init: function() {
            this.launcher = {
                text: resWe,
                iconCls: 'we-sm',
                handler: this.createWindow,
                scope: this
            }
        },

        createWindow: function() {
            var desktop = this.app.getDesktop();
            var win = desktop.getWindow('we-win');
            if (!win) {
                win = desktop.createWindow({
                    id: 'we-win',
                    title: resWe,
                    width: 550,
                    height: 400,
                    iconCls: 'we',
                    shim: false,
                    animCollapse: true,
                    constrainHeader: true,
                    layout: 'accordion',
                    border: false,
                    layoutConfig: {
                        animate: true
                    },
                    items: [
{
    title: resWhoAreWe,
    lines: false,
    autoScroll: true,
    html: '<p class="we-who"><img src="images/s.gif" align="left" />' + resWhoAreWe_Content + '</p><p class="we-who">' + resContactSentence + '</p>',
    listeners: { beforeExpand: function() { soundManager.play('default') } }
}, {
    title: resQualityPolicy,
    html: '<p class="we-qp"><img src="images/s.gif" align="left" />' + resQualityPolicy_Content + '</p>',
    autoScroll: true,
    listeners: { beforeExpand: function() { soundManager.play('default') } }
}, {
    title: resVision,
    html: '<p class="we-vision"><img src="images/s.gif" align="left" />' + resVision_Content + '</p>',
    autoScroll: true,
    listeners: { beforeExpand: function() { soundManager.play('default') } }
}, {
    title: resScope,
    html: '<p class="we-scope"><img src="images/s.gif" align="left" />' + resScope_Content + '</p>',
    autoScroll: true,
    listeners: { beforeExpand: function() { soundManager.play('default') } }
}, {
    title: resMission,
    html: '<p class="we-mission"><img src="images/s.gif" align="left" />' + resMission_Content + '</p>',
    autoScroll: true,
    listeners: { beforeExpand: function() { soundManager.play('default') } }
}
]
                });
            }
            win.show();
        }
    });

    //Servicios
    MyDesktop.ServicesWindow = Ext.extend(Ext.app.Module, {
        id: 'services-win',
        init: function() {
            this.launcher = {
                text: resServices,
                iconCls: 'services-sm',
                handler: this.createWindow,
                scope: this
            }
        },

        createWindow: function() {
            var desktop = this.app.getDesktop();
            var win = desktop.getWindow('services-win');
            if (!win) {
                win = desktop.createWindow({
                    id: 'services-win',
                    title: resServices,
                    width: 500,
                    height: 390,
                    iconCls: 'services',
                    shim: false,
                    animCollapse: true,
                    constrainHeader: true,
                    layout: 'accordion',
                    border: false,
                    layoutConfig: {
                        animate: true
                    },
                    items: [
{
    title: resService_SoftwareDevelopment,
    lines: false,
    autoScroll: true,
    html: '<p class="services-development"><img src="images/s.gif" align="left" />' + resService_SoftwareDevelopment_Content + '</p><p class="services-development">' + resContactSentence + '</p>',
    listeners: { beforeExpand: function() { soundManager.play('default') } }
}, {
    title: resService_Training,
    html: '<p class="services-training"><img src="images/s.gif" align="left" />' + resService_Training_Content + '</p><p class="services-training">' + resCoursesSentence + '</p><p class="services-training">' + resContactSentence + '</p>',
    autoScroll: true,
    listeners: { beforeExpand: function() { soundManager.play('default') } }
}, {
    title: resService_Hosting,
    html: '<p class="services-hosting"><img src="images/s.gif" align="left" />' + resService_Hosting_Content + '</p><p class="services-hosting">' + resContactSentence + '</p>',
    autoScroll: true,
    listeners: { beforeExpand: function() { soundManager.play('default') } }
}
]
                });
            }
            win.show();
        }
    });

    //Hosting
    var HostingWindowInit = false;
    MyDesktop.HostingWindow = Ext.extend(Ext.app.Module, {
        id: 'hosting-win',
        init: function() {
            this.launcher = {
                text: resHosting,
                iconCls: 'hosting-sm',
                handler: this.createWindow,
                scope: this
            }
        },
        createWindow: function() {
            var desktop = this.app.getDesktop();
            var win = desktop.getWindow('hosting-win');


            Ext.grid.RowExpander = function(config) {
                Ext.apply(this, config);

                this.addEvents({
                    beforeexpand: true,
                    expand: true,
                    beforecollapse: true,
                    collapse: true
                });

                Ext.grid.RowExpander.superclass.constructor.call(this);

                if (this.tpl) {
                    if (typeof this.tpl == 'string') {
                        this.tpl = new Ext.Template(this.tpl);
                    }
                    this.tpl.compile();
                }

                this.state = {};
                this.bodyContent = {};
            };

            Ext.grid.RowExpander = function(config) {
                Ext.apply(this, config);

                this.addEvents({
                    beforeexpand: true,
                    expand: true,
                    beforecollapse: true,
                    collapse: true
                });

                Ext.grid.RowExpander.superclass.constructor.call(this);

                if (this.tpl) {
                    if (typeof this.tpl == 'string')
                        this.tpl = new Ext.Template(this.tpl);
                    this.tpl.compile();
                }

                this.state = {};
                this.bodyContent = {};
            };

            Ext.extend(Ext.grid.RowExpander, Ext.util.Observable, {
                header: "",
                width: 20,
                sortable: false,
                fixed: true,
                menuDisabled: true,
                dataIndex: '',
                id: 'expander',
                lazyRender: true,
                enableCaching: true,

                getRowClass: function(record, rowIndex, p, ds) {
                    p.cols = p.cols - 1;
                    var content = this.bodyContent[record.id];
                    if (!content && !this.lazyRender) {
                        content = this.getBodyContent(record, rowIndex);
                    }
                    if (content)
                        p.body = content;
                    return this.state[record.id] ? 'x-grid3-row-expanded' : 'x-grid3-row-collapsed';
                },

                init: function(grid) {
                    this.grid = grid;

                    var view = grid.getView();
                    view.getRowClass = this.getRowClass.createDelegate(this);

                    view.enableRowBody = true;

                    grid.on('render', function() { view.mainBody.on('mousedown', this.onMouseDown, this); }, this);
                    HostingWindowInit = true;
                },

                getBodyContent: function(record, index) {
                    if (!this.enableCaching) {
                        return this.tpl.apply(record.data);
                    }
                    var content = this.bodyContent[record.id];
                    if (!content) {
                        content = this.tpl.apply(record.data);
                        this.bodyContent[record.id] = content;
                    }
                    return content;
                },

                onMouseDown: function(e, t) {
                    if (t.className == 'x-grid3-row-expander') {
                        e.stopEvent();
                        var row = e.getTarget('.x-grid3-row');
                        this.toggleRow(row);
                    }
                },

                renderer: function(v, p, record) {
                    p.cellAttr = 'rowspan="2"';
                    return '<div class="x-grid3-row-expander">&#160;</div>';
                },

                beforeExpand: function(record, body, rowIndex) {
                    if (this.fireEvent('beforeexpand', this, record, body, rowIndex) !== false) {
                        if (this.tpl && this.lazyRender) {
                            body.innerHTML = this.getBodyContent(record, rowIndex);
                        }
                        return true;
                    } else {
                        return false;
                    }
                },

                toggleRow: function(row) {
                    soundManager.play('default');
                    if (typeof row == 'number') {
                        row = this.grid.view.getRow(row);
                    }
                    this[Ext.fly(row).hasClass('x-grid3-row-collapsed') ? 'expandRow' : 'collapseRow'](row);
                },

                expandRow: function(row) {
                    if (typeof row == 'number') {
                        row = this.grid.view.getRow(row);
                    }
                    var record = this.grid.store.getAt(row.rowIndex);
                    var body = Ext.DomQuery.selectNode('tr:nth(2) div.x-grid3-row-body', row);
                    if (this.beforeExpand(record, body, row.rowIndex)) {
                        this.state[record.id] = true;
                        Ext.fly(row).replaceClass('x-grid3-row-collapsed', 'x-grid3-row-expanded');
                        this.fireEvent('expand', this, record, body, row.rowIndex);
                    }
                },

                collapseRow: function(row) {
                    if (typeof row == 'number') {
                        row = this.grid.view.getRow(row);
                    }
                    var record = this.grid.store.getAt(row.rowIndex);
                    var body = Ext.fly(row).child('tr:nth(1) div.x-grid3-row-body', true);
                    if (this.fireEvent('beforcollapse', this, record, body, row.rowIndex) !== false) {
                        this.state[record.id] = false;
                        Ext.fly(row).replaceClass('x-grid3-row-expanded', 'x-grid3-row-collapsed');
                        this.fireEvent('collapse', this, record, body, row.rowIndex);
                    }
                }
            });
            if (!win) {
                var xg = Ext.grid;
                var reader = new Ext.data.ArrayReader({}, [{ name: 'service' }, { name: 'desc'}]);
                var winExpander = new xg.RowExpander({ tpl: new Ext.Template('<hr/><p style="line-height: 17px;padding-top: 0px;">{desc}</p>') });
                var linExpander = new xg.RowExpander({ tpl: new Ext.Template('<hr/><p style="line-height: 17px;padding-top: 0px;">{desc}</p>') });
                win = desktop.createWindow({
                    id: 'hosting-win',
                    title: resHosting,
                    width: 500,
                    height: 365,
                    iconCls: 'hosting',
                    shim: false,
                    animCollapse: true,
                    constrainHeader: true,
                    layout: 'fit',
                    border: false,
                    items: [
new Ext.TabPanel({
    activeTab: 0,
    width: 600,
    height: 250,
    plain: true,
    defaults: { autoScroll: true },
    listeners: { beforetabchange: function() { if (HostingWindowInit) HostingWindowInit = false; else soundManager.play('default') } },
    items: [{
        title: resDescription,
        html: '<p class="hosting-description"><img src="images/s.gif" align="left" />' + resHosting_Description + '</p><p class="hosting-description">' + resContactSentence + '</p>'
    }, new xg.GridPanel({
        title: 'Windows',
        iconCls: 'win',
        cls: 'x-panel-grid',
        enableHdMenu: false,
        store: new Ext.data.Store({
            reader: reader,
            data: [
['Windows Server 2003', resHosting_Win2k3],
['ASP', resHosting_ASP],
['ASP.NET', resHosting_ASPNET],
['PHP', resHosting_PHP],
['MySQL', resHosting_MySQL],
['SQL Server', resHosting_SQLServer],
['Webmail', resHosting_Webmail],
['AntiSpam', resHosting_AntiSpam],
[resCDOComponent, resHosting_CDO],
['.NET Framework', resHosting_NET]
]
        }),
        cm: new xg.ColumnModel([
winExpander,
{ dataIndex: 'service', header: resServices, sortable: false }
]),
        viewConfig: { forceFit: true },
        plugins: winExpander,
        collapsible: true
    }), new xg.GridPanel({
        title: 'Linux',
        iconCls: 'tux',
        cls: 'x-panel-grid',
        enableHdMenu: false,
        store: new Ext.data.Store({
            reader: reader,
            data: [
['Linux', resHosting_Linux],
['ASP', resHosting_ASP],
['PHP', resHosting_PHP],
['MySQL', resHosting_MySQL],
['SQL Server', resHosting_SQLServer],
['Webmail', resHosting_Webmail],
['AntiSpam', resHosting_AntiSpam]
]
        }),
        cm: new xg.ColumnModel([
linExpander,
{ dataIndex: 'service', header: resServices, sortable: false }
]),
        viewConfig: { forceFit: true },
        plugins: linExpander,
        collapsible: true
    })]
})
]
                });
            }
            win.show();
        }
    });

    //Contacto
    var contactForm;
    MyDesktop.ContactWindow = Ext.extend(Ext.app.Module, {
        id: 'contact-win',
        init: function() {
            this.launcher = {
                text: resContact,
                iconCls: 'contact-sm',
                handler: this.createWindow,
                scope: this
            };
        },

        createWindow: function() {
            var desktop = this.app.getDesktop();
            var win = desktop.getWindow('contact-win');
            contactForm = new Ext.form.FormPanel({
                baseCls: 'x-plain',
                url: 'save-form.php',
                defaultType: 'textfield',
                waitMsgTarget: true,
                labelWidth: 75,
                title: '<table border="0" class="contactTitle"><tr><td><img src="images/s.gif" class="contact-phone" /></td><td>' + resContactTitle + '</td><td><img src="images/s.gif" class="contact-email" height="40" width="40" /></td></tr></table><hr/>',
                items: [
{
    fieldLabel: resName,
    name: 'Name',
    anchor: '-18',
    allowBlank: false,
    msgTarget: 'side',
    blankText: resRequiredField
}, {
    fieldLabel: resCompany,
    name: 'Company',
    anchor: '-18'
}, {
    fieldLabel: resPhone,
    name: 'Phone',
    anchor: '-18'
}, {
    fieldLabel: resEmail,
    name: 'email',
    vtype: 'email',
    msgTarget: 'side',
    anchor: '-18',
    vtypeText: resIncorrectEmail,
    allowBlank: false,
    blankText: resRequiredField
}, {
    hideLabel: true,
    name: 'Body',
    xtype: 'textarea',
    allowBlank: false,
    anchor: '-18 -104',
    msgTarget: 'side',
    blankText: resRequiredField
}]
            });
            if (!win) {
                win = desktop.createWindow({
                    id: 'contact-win',
                    title: resContact,
                    width: 500,
                    height: 350,
                    minWidth: 300,
                    minHeight: 250,
                    iconCls: 'contact',
                    shim: false,
                    animCollapse: true,
                    constrainHeader: true,
                    layout: 'fit',
                    border: false,
                    plain: true,
                    bodyStyle: 'padding:5px;',
                    buttonAlign: 'center',
                    layoutConfig: {
                        animate: true
                    },
                    items:
contactForm,
                    buttons: [{
                        text: resSend,
                        handler: function() {
                            if (contactForm.getForm().isValid()) {
                                Ext.MessageBox.show({
                                    msg: resSendingMail,
                                    progressText: resPleaseWait,
                                    width: 300,
                                    wait: true,
                                    waitConfig: { interval: 200 },
                                    icon: 'ext-mb-sendMail'
                                });
                                soundManager.play('default');
                                contactForm.getForm().submit({
                                    url: 'Contact.ashx',
                                    success: function() {
                                        soundManager.play('process');
                                        Ext.MessageBox.hide();
                                        Ext.MessageBox.show({
                                            title: resTitle,
                                            msg: resMailSended,
                                            width: 300,
                                            buttons: Ext.MessageBox.OK,
                                            icon: Ext.MessageBox.INFO,
                                            fn: function(btn) { win.close(); }
                                        });
                                    },
                                    failure: function() {
                                        soundManager.play('error');
                                        Ext.MessageBox.hide();
                                        Ext.MessageBox.show({
                                            title: resTitle,
                                            msg: resMailNotSended,
                                            width: 300,
                                            buttons: Ext.MessageBox.OK,
                                            icon: Ext.MessageBox.ERROR
                                        });
                                    }
                                });
                            }
                            else
                                soundManager.play('error');
                        }
                    }, {
                        text: resReset,
                        handler: function() {
                            soundManager.play('default');
                            contactForm.getForm().reset();
                        }
}]
                    });
                }
                win.show();
            }
        });

        //Feed
        var mainPanel;
        MyDesktop.FeedWindow = Ext.extend(Ext.app.Module, {
            id: 'feed-win',
            init: function() {
                this.launcher = {
                    text: resFeed,
                    iconCls: 'feed-sm',
                    handler: this.createWindow,
                    scope: this
                }
            },
            createWindow: function() {
                var desktop = this.app.getDesktop();
                var win = desktop.getWindow('feed-win');
                mainPanel = new MainPanel();
                if (!win) {
                    win = desktop.createWindow({
                        id: 'feed-win',
                        title: resFeed,
                        width: '90%',
                        height: 500,
                        iconCls: 'feed',
                        shim: false,
                        animCollapse: true,
                        constrainHeader: true,
                        layout: 'fit',
                        border: false,
                        items: [mainPanel],
                        layoutConfig: { animate: true }
                    });
                    mainPanel.loadFeed({ text: 'Programando a medianoche' });
                }
                win.show();
            }
        });

        //Glosario
        MyDesktop.GlossaryTerms = function(config) {
            var config = config || {};
            Ext.applyIf(config, {
                reader: new Ext.data.XmlReader({
                    record: 'Term',
                    id: 'Name',
                    totalRecords: '@total'
                }, ['Name', 'Description'])
            });
            // call the superclass's constructor
            MyDesktop.GlossaryTerms.superclass.constructor.call(this, config);
        };
        Ext.extend(MyDesktop.GlossaryTerms, Ext.data.Store);

        MyDesktop.GlossaryGrid = Ext.extend(Ext.grid.GridPanel, {
            initComponent: function() {
                Ext.apply(this, {
                    columns: [
{ header: resTerm, dataIndex: 'Name', sortable: true }
],
                    enableHdMenu: false,
                    sm: new Ext.grid.RowSelectionModel({ singleSelect: true }),
                    store: new MyDesktop.GlossaryTerms({
                        storeId: 'gridGlossaryTerms',
                        url: desktopLang + '/Glossary.xml'
                    }),
                    viewConfig: {
                        forceFit: true
                    }
                });
                // finally call the superclasses implementation
                MyDesktop.GlossaryGrid.superclass.initComponent.call(this);
            }
        });
        Ext.reg('GlossaryGrid', MyDesktop.GlossaryGrid);

        MyDesktop.GlossaryDetail = Ext.extend(Ext.Panel, {
            tplMarkup: [
'<b>' + resTerm + ':</b> {Name}<br/>',
'<b>' + resDescription + ':</b> {Description}'
],
            startingMarkup: resSelectTerm,
            initComponent: function() {
                this.tpl = new Ext.Template(this.tplMarkup);
                Ext.apply(this, {
                    bodyStyle: {
                        background: '#ffffff',
                        padding: '7px'
                    },
                    html: this.startingMarkup
                });
                MyDesktop.GlossaryDetail.superclass.initComponent.call(this);
            },
            updateDetail: function(data) {
                this.tpl.overwrite(this.body, data);
            }
        });
        Ext.reg('GlossaryDetail', MyDesktop.GlossaryDetail);

        MyDesktop.GlossaryWindow = Ext.extend(Ext.app.Module, {
            id: 'glossary-win',
            init: function() {
                this.launcher = {
                    text: resGlossary,
                    iconCls: 'glossary-sm',
                    handler: this.createWindow,
                    scope: this
                }
            },

            createWindow: function() {
                var desktop = this.app.getDesktop();
                var win = desktop.getWindow('glossary-win');
                if (!win) {
                    glossaryFirst = true;
                    win = desktop.createWindow({
                        id: 'glossary-win',
                        title: resGlossary,
                        width: 500,
                        height: 400,
                        iconCls: 'glossary',
                        shim: false,
                        layout: 'border',
                        border: false,
                        layoutConfig: {
                            animate: true
                        },
                        items: [{
                            xtype: 'GlossaryGrid',
                            itemId: 'gridPanel',
                            region: 'north',
                            height: 210,
                            split: true
                        }, {
                            xtype: 'GlossaryDetail',
                            itemId: 'detailPanel',
                            region: 'center',
                            cls: 'sliding',
                            autoScroll: true
}]
                        });
                    }
                    win.show();

                    var GlossaryGridSm = win.getComponent('gridPanel').getSelectionModel();
                    GlossaryGridSm.on('rowselect', this.onRowSelect, this);
                    Ext.StoreMgr.get('gridGlossaryTerms').load();
                },
                onRowSelect: function(sm, rowIdx, r) {
                    soundManager.play('slide');
                    var detailPanel = this.app.getDesktop().getWindow('glossary-win').getComponent('detailPanel');
                    detailPanel.updateDetail(r.data);
                    detailPanel.body.slideIn('t', { stopFx: true, duration: .2 });
                }
            });

            //Clientes
            var clientsWin;
            MyDesktop.ClientsWindow = Ext.extend(Ext.app.Module, {
                id: 'clients-win',
                init: function() {
                    this.launcher = {
                        text: resClients,
                        //iconCls: 'clients-sm',
                        handler: this.createWindow,
                        scope: this
                    }
                },
                createWindow: function() {
                    var desktop = this.app.getDesktop();
                    var clientsWin = desktop.getWindow('clients-win');
                    if (!clientsWin) {
                        clientsWin = desktop.createWindow({
                            id: 'clients-win',
                            title: resClients,
                            width: 530,
                            height: 400,
                            background: '#ffffff',
                            html: '<p align="center" class="imagesBorder">' +
                                    '<img src="images/clients/site/AFClassic.gif" title="AFClassic"/>' +
                                    '<img src="images/clients/site/BairesWeb.gif" title="BairesWeb"/>' +
                                    '<img src="images/clients/site/Banelco.gif" title="Banelco"/>' +
                                    '<img src="images/clients/site/Bimbo.gif" title="Bimbo de Argentina"/>' +
                                    '<img src="images/clients/site/BPScouts.gif" title="Baden Powell Scouts Argentina"/>' +
                                    '<img src="images/clients/site/Budweiser.gif" title="Budweiser"/>' +
                                    '<img src="images/clients/site/CajVal.gif" title="Caja de Valores"/>' +
                                    '<img src="images/clients/site/Canchallena.gif" title="Canchallena"/>' +
                                    '<img src="images/clients/site/CDA.gif" title="CDA"/>' +
                                    '<img src="images/clients/site/ClaudioG.gif" title="Claudio Guiragossian"/>' +
                                    '<img src="images/clients/site/Conpaini.gif" title="Conpaini"/>' +
                                    '<img src="images/clients/site/Cooperativa-Luz-y-Fuerza.gif" title="Cooperativa de Seguros Luz y Fuerza"/>' +
                                    '<img src="images/clients/site/Danone.gif" title="Danone"/>' +
                                    '<img src="images/clients/site/DGB.gif" title="Dobniewski & García Berros Abogados"/>' +
                                    '<img src="images/clients/site/ECPS.gif" title="Gesti&oacute;n Inform&aacute;tica ECPS"/>' +
                                    '<img src="images/clients/site/EfectivoSi.gif" title="Efectivo S&iacute;"/>' +
                                    '<img src="images/clients/site/ESR.gif" title="ESR & Asociados"/>' +
                                    '<img src="images/clients/site/ExCle.gif" title="Ex-Cl&eacute; Soluciones Biom&eacute;tricas"/>' +
                                    '<img src="images/clients/site/FAPEDEC.gif" title="Fundaci&oacute;n Argentina para el Desarrollo de la Educaci&oacute;n y la Cultura"/>' +
                                    '<img src="images/clients/site/Fiat.gif" title="Fiat Argentina"/>' +
                                    '<img src="images/clients/site/GeoExplora.gif" title="GeoExplora"/>' +
                                    '<img src="images/clients/site/ImagenGrafica.gif" title="Imagen Gr&aacute;fica"/>' +
                                    '<img src="images/clients/site/LG.gif" title="LG"/>' +
                                    '<img src="images/clients/site/Loreal.gif" title="L\'Or&eacute;al"/>' +
                                    '<img src="images/clients/site/Maybelline.gif" title="Maybelline"/>' +
                                    '<img src="images/clients/site/Medcenter.gif" title="Medcenter"/>' +
                                    '<img src="images/clients/site/Nestle.gif" title="Nestle"/>' +
                                    '<img src="images/clients/site/KraftFoods.gif" title="Kraft Foods"/>' +
                                    '<img src="images/clients/site/OpticasLam.gif" title="&Oacute;pticas Lam"/>' +
                                    '<img src="images/clients/site/PagoMisCuentas.gif" title="Pago mis cuentas"/>' +
                                    '<img src="images/clients/site/PaseosImaginarios.gif" title="Paseos imaginarios"/>' +
                                    '<img src="images/clients/site/Pedigree.gif" title="Pedigree"/>' +
                                    '<img src="images/clients/site/PoscastVision.gif" title="Podcast Vision"/>' +
                                    '<img src="images/clients/site/SanofiAventis.gif" title="Sanofi-Aventis"/>' +
                                    '<img src="images/clients/site/Schick.gif" title="Schick"/>' +
                                    '<img src="images/clients/site/Ser.gif" title="Ser"/>' +
                                    '<img src="images/clients/site/Smartfield.gif" title="Smartfield"/>' +
                                    '<img src="images/clients/site/SPC.gif" title="Sanatorio Privado del Centro"/>' +
                                    '<img src="images/clients/site/TripleD.gif" title="DDD S.A."/>' +
                                    '</p>',
                            iconCls: 'clients',
                            shim: false,
                            border: false,
                            autoScroll: true,
                            layoutConfig: {
                                animate: true
                            }
                        });
                    }
                    clientsWin.show();
                }
            });

                    //Lista de los tutoriales
                    MyDesktop.TutorialsWindow = Ext.extend(Ext.app.Module, {
                        id: 'tut-win',
                        init: function() {
                            this.launcher = {
                                text: resTutorials,
                                iconCls: 'tut-sm',
                                handler: this.createWindow,
                                scope: this,
                                windowId: windowIndex,
                                menu: {
                                    cls: 'whiteBack',
                                    items: [{
                                        text: resCreateEmailAccount,
                                        iconCls: 'tut-newaccount-sm',
                                        handler: tutNewAccountWindow.createWindow,
                                        scope: this,
                                        windowId: windowIndex++
                                    }, {
                                        text: 'Filezilla',
                                        iconCls: 'tut-filezilla-sm',
                                        handler: tutFilezillaWindow.createWindow,
                                        scope: this,
                                        windowId: windowIndex++
                                    }, {
                                        text: 'Outlook',
                                        iconCls: 'tut-outlook-sm',
                                        handler: tutOutlookWindow.createWindow,
                                        scope: this,
                                        windowId: windowIndex++
                                    }, {
                                        text: 'Outlook Express',
                                        iconCls: 'tut-outlookexp-sm',
                                        handler: tutOutExpWindow.createWindow,
                                        scope: this,
                                        windowId: windowIndex++
                                    }, {
                                        text: 'Thunderbird',
                                        iconCls: 'tut-thunderbird-sm',
                                        handler: tutThunderWindow.createWindow,
                                        scope: this,
                                        windowId: windowIndex++
}]
                                    }
                                }
                            },

                            createWindow: function() {
                                var desktop = this.app.getDesktop();
                                var win = desktop.getWindow('tut-win');
                                if (!win) {
                                    win = desktop.createWindow({
                                        id: 'tut-win',
                                        title: resTutorials,
                                        width: 400,
                                        height: 120,
                                        iconCls: 'tut',
                                        shim: false,
                                        animCollapse: true,
                                        constrainHeader: true,
                                        layout: 'fit',
                                        border: false,
                                        layoutConfig: {
                                            animate: true
                                        },
                                        items: [{
                                            region: 'center',
                                            autoScroll: true,
                                            html: '<div id="tut-shortcuts">' +
'<div class="tutorial tut-newaccount-win" id="tutNewAccount-shortcut"><a onfocus="this.blur();" href="#"><img src="images/s.gif"/><br/>' + resCreateEmailAccount + '</a></div>' +
'<div class="tutorial tut-filezilla-win" id="tutFilezilla-shortcut"><a onfocus="this.blur();" href="#"><img src="images/s.gif"/><br/>FileZilla</a></div>' +
'<div class="tutorial tut-outlook-win" id="tutOutlook-shortcut"><a onfocus="this.blur();" href="#"><img src="images/s.gif"/><br/>Outlook</a></div>' +
'<div class="tutorial tut-outexp-win" id="tutOutExp-shortcut"><a onfocus="this.blur();" href="#"><img src="images/s.gif"/><br/>Outlook Express</a></div>' +
'<div class="tutorial tut-thunder-win" id="tutThunder-shortcut"><a onfocus="this.blur();" href="#"><img src="images/s.gif"/><br/>Thunderbird</a></div>' +
'</div>'
}]
                                        });
                                    }
                                    win.show();

                                    var tut_shortcuts = Ext.get('tut-shortcuts');
                                    tut_shortcuts.on('click', function(e, t) {
                                        if (t = e.getTarget('div', tut_shortcuts)) {
                                            e.stopEvent();
                                            var win = eval(t.id.replace('-shortcut', '') + 'Window');
                                            if (win)
                                                win.createWindow();
                                        }
                                    });
                                }
                            });

                            //Tutorial: Nueva cuenta de correo
                            MyDesktop.TutNewAccountWindow = Ext.extend(Ext.app.Module, {
                                id: 'tut-newaccount',
                                init: function() {
                                    this.launcher = {
                                        handler: this.createWindow
                                    }
                                },
                                createWindow: function() {
                                    var desktop = desktopApp.getDesktop();
                                    var win = desktop.getWindow('tut-newaccount-win');
                                    if (!win) {
                                        win = desktop.createWindow({
                                            id: 'tut-newaccount-win',
                                            title: resTutorial + ': ' + resCreateEmailAccount,
                                            width: 750,
                                            height: 500,
                                            iconCls: 'tut-newaccount',
                                            border: false,
                                            layoutConfig: { animate: true },
                                            html: '<iframe frameborder="0" width="100%" height="100%" src="' + desktopLang + '/Tutorial/NewAccount.html"></iframe>'
                                        });
                                    }
                                    win.show();
                                }
                            });

                            //Tutorial: Outlook
                            MyDesktop.TutOutlookWindow = Ext.extend(Ext.app.Module, {
                                id: 'tut-outlook',
                                init: function() {
                                    this.launcher = {
                                        handler: this.createWindow
                                    }
                                },
                                createWindow: function() {
                                    var desktop = desktopApp.getDesktop();
                                    var win = desktop.getWindow('tut-outlook-win');
                                    if (!win) {
                                        win = desktop.createWindow({
                                            id: 'tut-outlook-win',
                                            title: resTutorial + ': Outlook',
                                            width: 700,
                                            height: 500,
                                            iconCls: 'tut-outlook',
                                            border: false,
                                            layoutConfig: { animate: true },
                                            html: '<iframe frameborder="0" width="100%" height="100%" src="' + desktopLang + '/Tutorial/Outlook.html"></iframe>'
                                        });
                                    }
                                    win.show();
                                }
                            });

                            //Tutorial: Outlook Express
                            MyDesktop.TutOutExpWindow = Ext.extend(Ext.app.Module, {
                                id: 'tut-outexp',
                                init: function() {
                                    this.launcher = {
                                        handler: this.createWindow
                                    }
                                },
                                createWindow: function() {
                                    var desktop = desktopApp.getDesktop();
                                    var win = desktop.getWindow('tut-outexp-win');
                                    if (!win) {
                                        win = desktop.createWindow({
                                            id: 'tut-outexp-win',
                                            title: resTutorial + ': Outlook Express',
                                            width: 730,
                                            height: 500,
                                            iconCls: 'tut-outlookexp',
                                            border: false,
                                            layoutConfig: { animate: true },
                                            html: '<iframe frameborder="0" width="100%" height="100%" src="' + desktopLang + '/Tutorial/OutlookExpress.html"></iframe>'
                                        });
                                    }
                                    win.show();
                                }
                            });

                            //Tutorial: Filezilla
                            MyDesktop.TutFilezillaWindow = Ext.extend(Ext.app.Module, {
                                id: 'tut-filezilla',
                                init: function() {
                                    this.launcher = {
                                        handler: this.createWindow
                                    }
                                },
                                createWindow: function() {
                                    var desktop = desktopApp.getDesktop();
                                    var win = desktop.getWindow('tut-filezilla-win');
                                    if (!win) {
                                        win = desktop.createWindow({
                                            id: 'tut-filezilla-win',
                                            title: resTutorial + ': Filezilla',
                                            width: 700,
                                            height: 500,
                                            iconCls: 'tut-filezilla',
                                            border: false,
                                            layoutConfig: { animate: true },
                                            html: '<iframe frameborder="0" width="100%" height="100%" src="' + desktopLang + '/Tutorial/Filezilla.html"></iframe>'
                                        });
                                    }
                                    win.show();
                                }
                            });

                            //Tutorial: Thunderbird
                            MyDesktop.TutThunderWindow = Ext.extend(Ext.app.Module, {
                                id: 'tut-thunder',
                                init: function() {
                                    this.launcher = {
                                        handler: this.createWindow
                                    }
                                },
                                createWindow: function() {
                                    var desktop = desktopApp.getDesktop();
                                    var win = desktop.getWindow('tut-thunder-win');
                                    if (!win) {
                                        win = desktop.createWindow({
                                            id: 'tut-thunder-win',
                                            title: resTutorial + ': Thunderbird',
                                            width: 670,
                                            height: 500,
                                            iconCls: 'tut-thunderbird',
                                            border: false,
                                            layoutConfig: { animate: true },
                                            html: '<iframe frameborder="0" width="100%" height="100%" src="' + desktopLang + '/Tutorial/Thunderbird.html"></iframe>'
                                        });
                                    }
                                    win.show();
                                }
                            });

                            //Cursos
                            var coursesWin;
                            MyDesktop.CoursesWindow = Ext.extend(Ext.app.Module, {
                                id: 'courses-win',
                                init: function() {
                                    this.launcher = {
                                        text: resCourses,
                                        iconCls: 'courses-sm',
                                        handler: this.createWindow,
                                        scope: this
                                    }
                                },
                                createWindow: function() {
                                    if (!coursesWin || !coursesWin.view.store) {
                                        coursesWin = new CourseChooser({
                                            url: desktopLang + '/Courses.txt',
                                            width: 650,
                                            height: 530
                                        });
                                        coursesWin.show(this.app.getDesktop());
                                    }
                                    else
                                        coursesWin.win.show();
                                }
                            });

                            var CourseChooser = function(config) {
                                this.config = config;
                            }

                            var CourseChooserFirst = false;
                            CourseChooser.prototype = {
                                lookup: {},
                                show: function(desktop) {
                                    if (!this.win) {
                                        this.initTemplates();

                                        this.store = new Ext.data.JsonStore({
                                            url: this.config.url,
                                            root: 'courses',
                                            fields: ['id', 'name', 'pdf', 'xps', 'xpsSize', 'pdfSize', 'duration', 'note', 'prerequisite', 'details'],
                                            listeners: {
                                                'load': { fn: function() { this.view.select(0); }, scope: this, single: true }
                                            }
                                        });
                                        this.store.load();
                                        CourseChooserFirst = true;
                                        var formatData = function(data) {
                                            data.shortName = data.name.ellipse(14);
                                            this.lookup[data.name] = data;
                                            return data;
                                        };

                                        this.view = new Ext.DataView({
                                            tpl: this.thumbTemplate,
                                            singleSelect: true,
                                            overClass: 'x-view-over',
                                            itemSelector: 'div.thumb-wrap',
                                            emptyText: '<div style="padding:10px;">' + resNoCoursesFound + '</div>',
                                            store: this.store,
                                            listeners: {
                                                'selectionchange': { fn: this.showDetails, scope: this, buffer: 100 },
                                                'dblclick': { fn: this.doCallback, scope: this },
                                                'loadexception': { fn: this.onLoadException, scope: this },
                                                'beforeselect': { fn: function(view) { return view.store.getRange().length > 0; } }
                                            },
                                            prepareData: formatData.createDelegate(this)
                                        });

                                        var cfg = {
                                            title: resCourses,
                                            id: 'course-chooser-dlg',
                                            layout: 'border',
                                            width: 650,
                                            height: 530,
                                            minWidth: 650,
                                            minHeight: 300,
                                            border: false,
                                            items: [{
                                                region: 'north',
                                                html: '<div class="coursesHeader"><table width="88%" border="0"><tr><td>' + resCoursesHeader + '</td></tr></table></div>',
                                                height: 100,
                                                autoScroll: true
                                            }, {
                                                id: 'course-chooser-view',
                                                region: 'west',
                                                autoScroll: true,
                                                items: this.view,
                                                width: 290
                                            }, {
                                                id: 'course-detail-panel',
                                                region: 'center',
                                                cls: 'sliding',
                                                autoScroll: true
}],
                                                iconCls: 'courses'
                                            };
                                            Ext.apply(cfg, this.config);
                                            this.win = desktop.createWindow(cfg);
                                        }

                                        this.win.show();
                                    },

                                    initTemplates: function() {
                                        this.thumbTemplate = new Ext.XTemplate(
'<tpl for=".">',
'<div class="thumb-wrap" id="{name}">',
'<div class="thumb"><img src="Images/Courses/{id}.png" title="{name}"></div>',
'<span>{name}</span></div>',
'</tpl>'
);
                                        this.thumbTemplate.compile();

                                        this.detailsTemplate = new Ext.XTemplate(
'<div class="details">',
'<table border="0"><tr><td><img src="Images/Courses/{id}.gif" title="{name}"></td>',
'<td class="courseTitle">{name}</td></tr></table>',
'<div class="details-info">',
'<b>' + resCourseDuration + ':</b>',
'<span><ul class="courseList"><tpl for="duration"><li>{.}</li></tpl></ul></span>',
'<tpl if="prerequisite">',
'<b>' + resPrerequisites + ':</b>',
'<span><ul class="courseList"><tpl for="prerequisite">',
'<li>{.}</li>',
'</tpl></ul></span>',
'</tpl>',
'<tpl if="note">',
'<b>' + resNote + ':</b>',
'<span>{note}</span>',
'</tpl>',
'<b>' + resDownloadTopics + ':</b>',
'<table align="center"><tr><td align="center">',
'<a href="Download.ashx?id={pdf}" target="_blank" onfocus="this.blur();"><img src="images/s.gif" class="iconPDF" /></a>',
'</td><td align="center">',
'<a href="Download.ashx?id={xps}" target="_blank" onfocus="this.blur();"><img src="images/s.gif" class="iconXPS" /></a>',
'</td></tr><tr><td align="center">',
'<a href="Download.ashx?id={pdf}" target="_blank" onfocus="this.blur();" class="fileDescription">Adobe Acrobat (PDF)<br/>({pdfSize})</a>',
'</td><td align="center">',
'<a href="Download.ashx?id={xps}" target="_blank" onfocus="this.blur();" class="fileDescription">XML Paper Specification (XPS)<br/>({xpsSize})</a>',
'</td></tr></table>',
'<b>' + resCourseTopics + ':</b>',
'<span><ul class="courseList"><tpl for="details">',
'<li>{item}</li>',
'<tpl if="detail">',
'<ul class="courseList"><tpl for="detail">',
'<li>{.}</li>',
'</tpl></ul>',
'</tpl>',
'</tpl></ul></span>',
'</div>',
'</div>'
);
                                        this.detailsTemplate.compile();
                                    },

                                    showDetails: function() {
                                        if (CourseChooserFirst)
                                            CourseChooserFirst = false;
                                        else
                                            soundManager.play('slide');
                                        var selNode = this.view.getSelectedNodes();
                                        var detailEl = Ext.getCmp('course-detail-panel').body;
                                        if (selNode && selNode.length > 0) {
                                            selNode = selNode[0];
                                            var data = this.lookup[selNode.id];
                                            detailEl.hide();
                                            this.detailsTemplate.overwrite(detailEl, data);
                                            detailEl.slideIn('l', { stopFx: true, duration: .2 });
                                        } else {
                                            detailEl.update('');
                                        }
                                    },

                                    onLoadException: function(v, o) {
                                        this.view.getEl().update('<div style="padding:10px;">Error loading images.</div>');
                                    }
                                };

                                String.prototype.ellipse = function(maxLength) {
                                    if (this.length > maxLength) {
                                        return this.substr(0, maxLength - 2) + '...';
                                    }
                                    return this;
                                };

                                //Lista de las descargas
                                MyDesktop.DownloadsWindow = Ext.extend(Ext.app.Module, {
                                    id: 'down-win',
                                    init: function() {
                                        this.launcher = {
                                            text: resDownloads,
                                            iconCls: 'down-sm',
                                            handler: this.createWindow,
                                            scope: this,
                                            windowId: windowIndex,
                                            menu: {
                                                cls: 'whiteBack',
                                                items: [{
                                                    text: 'Scientia&reg; Resource Translator (606 KB)',
                                                    iconCls: 'down-srt-sm',
                                                    handler: function() { window.open('download.ashx?id=1') },
                                                    scope: this,
                                                    windowId: windowIndex++
}]
                                                }
                                            }
                                        },

                                        createWindow: function() {
                                            var desktop = this.app.getDesktop();
                                            var win = desktop.getWindow('down-win');
                                            if (!win) {
                                                win = desktop.createWindow({
                                                    id: 'down-win',
                                                    title: resDownloads,
                                                    width: 200,
                                                    height: 150,
                                                    iconCls: 'down',
                                                    shim: false,
                                                    animCollapse: true,
                                                    constrainHeader: true,
                                                    layout: 'fit',
                                                    border: false,
                                                    layoutConfig: {
                                                        animate: true
                                                    },
                                                    items: [{
                                                        region: 'center',
                                                        autoScroll: true,
                                                        html: '<div id="down-shortcuts">' +
'<div class="downloads down-srt-win" id="SRT-shortcut"><a onfocus="this.blur();" href="download.ashx?id=1"><img src="images/s.gif"/><br/>Scientia&reg; Resource Translator (606 KB)</a></div>' +
'</div>'
}]
                                                    });
                                                }
                                                win.show();
                                            }
                                        });

                                        //Bienvenida
                                        function welcome() {
                                            if (typeof (startUpWindow) != 'undefined')
                                                showWindow(startUpWindow);
                                            else {
                                                if (document.cookie.indexOf('welcomeWin') == -1) {
                                                    document.cookie = "welcomeWin=1; path=/;";
                                                    var welcomeWin = desktopApp.getDesktop().createWindow({
                                                        id: 'welcome-win',
                                                        title: 'Bienvenido - Welcome - Bem-vindo',
                                                        width: 600,
                                                        height: 400,
                                                        iconCls: 'scientia',
                                                        shim: false,
                                                        border: false,
                                                        layoutConfig: {
                                                            animate: true
                                                        },
                                                        html: '<iframe frameborder="0" width="100%" height="100%" src="Welcome.html"></iframe>'
                                                    });
                                                    welcomeWin.show();
                                                }
                                            }
                                        }
