/*
 * Ext JS Library 1.1.1
 * Copyright(c) 2006-2007, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://www.extjs.com/license
 */

// create the LayoutExample application (single instance)
var NoticiasCOMCO = function(){
    // everything in this space is private and only accessible in the HelloWorld block
    
    // define some private variables
    var dialog, showBtn;
    
    var toggleTheme = function(){
        Ext.get(document.body, true).toggleClass('xtheme-gray');
    };
    // return a public interface
    return {
        init : function(){
             showBtn = Ext.get('show-noticias', true);
             // attach to click event
             showBtn.on('click', this.showDialog, this);  
        },
                
        showDialog : function(){
            if(!dialog){ // lazy initialize the dialog and only create it once
                dialog = new Ext.LayoutDialog("contenidoNoticia", { 
                        modal:true,
                        width:742,
                        height:478,
                        shadow:true,
                        minWidth:840,
                        minHeight:600,
                        proxyDrag: true,
                        resizable: false,
	                    center: {
	                        autoScroll:true,
	                        tabPosition: 'top',
	                        closeOnTab: false,
	                        alwaysShowTabs: false
	                    }
                });
                dialog.addKeyListener(27, dialog.hide, dialog);
                //dialog.addButton('Volver', dialog.hide, dialog);
                
                var layout = dialog.getLayout();
                layout.beginUpdate();
	            layout.add('center', new Ext.ContentPanel('centerNoticia', {title: 'Noticias'}));
	            layout.endUpdate();
            }
            dialog.show(showBtn.dom);
        }
    };
}();

// using onDocumentReady instead of window.onload initializes the application
// when the DOM is ready, without waiting for images and other resources to load
Ext.EventManager.onDocumentReady(NoticiasCOMCO.init, NoticiasCOMCO, true);