Ext.ns('com.wilsonalvarez.net');

//the blank image
Ext.BLANK_IMAGE_URL = '../ext-2.3.0/resources/images/default/s.gif';


	Treenote = new Ext.tree.TreePanel({
								title: 'Notes',
								collapsible: true,
								id:'treeclients',
								titleCollapse: true,
								autoScroll: true,
								border: false,
								height:500,
								maskDisabled: false,
								animCollapse: true,
								autoLoad:false,
                                root: {
                                    text: 'Client List',
                                    iconCls: 'treecss',
									expanded: true
                                },
                                loader: {
                                    url: 'treenotes.php'
                                },
				 listeners: {
	            	'render': function (tp){
                    				tp.getSelectionModel().on('selectionchange', function(tree, node){
                        			
									try{
										
										var id=node.id;
										id_note=id;
										var type=node.id.substring(0,1);
													if(id!='xnode-3')
														if(type!="N"){
														viewnote(id);}
														else{
															codUserActive=id.substring(1);
															Ext.getCmp('envio').getForm().reset();
															}
									}catch(err){}
												
	                   					
									});
								}
							
					,'beforeexpandnode': function (tp){
						
									codUserActive=''+tp;
                    				codUserActive=codUserActive.substring(1);
									codUserActive=codUserActive.substring(0,codUserActive.length-1);
									codUserActive=codUserActive=codUserActive.substring(6);
						
								}
	       					}//fin listener		
							

							   
							   
	});

Treenote.on("beforeload", function(treeLoader, node) {
								   
        Treenote.getLoader().baseParams.codUser = codUser;
		Ext.getCmp('usermane').setText('Hi, '+clientename);
		
		size=160;
		if(clientename.length>14)
			size=160-(clientename.length-14)*14;
			
		if(codUserType!=1){
		Ext.getCmp('sapace').setWidth(size);
		Ext.getCmp('treeclients').getRootNode().setText('Note List');
		Ext.getCmp('state').hide();
		Ext.getCmp('btnUser').hide();
			
		}
    });

