var imagesTreePanel;
Ext.onReady(function() {
    Ext.QuickTips.init();
    Ext.form.Field.prototype.msgTarget = 'side';
    
	imagesTreePanel = new Ext.ux.FileTreePanel({
         url: App.baseUrl + '/admin/category_image/tree-panel'
		,id:'ftp'
        ,border: false
        ,containerScroll: true
		,title: 'รูปภาพ'
		,rootPath: 'halu'
        ,rootText: 'รูปภาพ'
        ,hrefPrefix: App.baseUrl + '/media/'
		,topMenu:true
		,autoScroll:true
		,enableProgress:false
        ,enableOpen: false
	});
    
    imagesTreePanel.on('dblclick', function(node) {
        if (!node.isLeaf())
            return;
        var path = imagesTreePanel.getPath(node);
        path = path.replace(/halu/, '');
        Halu.Images.addToStore(path);
    });
});