
ventanaSistema = function() {
// Constructor
            //Crea ventana principal junto con su configuracion de areas 
            this.ventana = new Ext.BorderLayout(document.body, {
                hideOnLayout: true,
                north: {
                    split:false,
                    initialSize: 50,
                    titlebar: false
                },
                west: {
                    split:true,
                    initialSize: 125,
                    minSize: 125,
                    maxSize: 125,
                    titlebar: true,
                    collapsible: true,
                    animate: true,
                    autoScroll:false,
                    useShim:true,
                    cmargins: {top:0,bottom:2,right:2,left:2}
                },
                east: {
                    split:true,
                    initialSize: 4,
                    minSize: 25,
                    maxSize: 25,
                    titlebar: true,
                    collapsible: true,
                    animate: true,
                    autoScroll:false,
                    useShim:true,
                    collapsed:true,
                    cmargins: {top:0,bottom:2,right:2,left:2}
                },
                south: {
                    split:false,
                    initialSize: 22,
                    titlebar: false,
                    collapsible: false,
                    animate: false
                },
                center: {
                    titlebar: false,
                    autoScroll:false,
                    tabPosition: 'top',
                    closeOnTab: true,
                    alwaysShowTabs: true,
                    resizeTabs: true
                }
            });			
		
            //Indica a  ventana que no cargue las paginas hasta que se le indique
            this.ventana.beginUpdate();
			
			//Direcciona el encabezado
            this.ventana.add('north', new Ext.ContentPanel('north'));
            
            //Inicializa la barra de estado
			this.ventana.add('south', new Ext.ContentPanel('south'));
		
			// Crea el panel de menu y botonera
			this.ventana.add('west', new Ext.ContentPanel('west', {title: 'Menú', fitToFrame:true, resizeEl:'menuUsuario'}));
			
			// Crea el Panel de tutoriales
            //this.ventana.add('east', new Ext.ContentPanel('east', {title: 'Novedades', fitToFrame:true}));
			this.ventana.add('east', new Ext.ContentPanel('east'));
			
			// despliega la ventana
            this.ventana.restoreState();
            this.ventana.endUpdate();
};

ventanaSistema.prototype = {
	norte : function(){ return  this.ventana.findPanel('north');},
	
	sur    : function(){ return  this.ventana.findPanel('south');},
	
	oeste  : function(){ return  this.ventana.findPanel('west' );},
	
	este   : function(){ return  this.ventana.findPanel('east' );},
	
	centro : function(){ return  this.ventana.findPanel('center' );}
	
};

ventanaDatos = function(conteiner,area){
	if(conteiner){
		var dh = Ext.DomHelper;
		this.el = dh.append(Ext.get(conteiner).dom, {tag: 'div'}, true);
		YAHOO.util.Dom.generateId(this.el);	
	
		var south = { split:true, initialSize: 250, minSize: 100, maxSize: 580, autoScroll:true, collapsible:true, titlebar: true, animate: true, cmargins: {top:2,bottom:0,right:0,left:0}};
		var center = { autoScroll:false, titlebar:true };
	
	// si no viene area asume que seran centro y sur
		if (!area){
			area = { south:south, center:center };
		}else{
			  area =  { center:center };
		}
		
		this.ventana = new Ext.BorderLayout(this.el,area ); 
	}
};

ventanaDatos.prototype = {
	sur    : function(){ return  this.ventana.findPanel('south');},

	centro : function(){ return  this.ventana.findPanel('center' );}
	
};
