GO.projects2.SelectProject = function(config){
	
	var config = config || {};
	//Ext.apply(this, config);
	
	Ext.applyIf(config,{
		displayField: 'path',
		hiddenName:'project_id',
		valueField: 'id',
		emptyText:GO.lang.none,
		triggerAction:'all',
		mode:'remote',
		editable: true,
		tpl: new Ext.XTemplate(
//			'{[this.currentKey = null]}' +
			'<tpl>{[this.resetCurrentKey()]}</tpl>'+
			'<tpl for=".">'+
			  '<tpl if="this.shouldShowHeader(values.path)">' +
				'<div class="menu-title">{[this.showHeader(values.path)]}</div>' +
			  '</tpl>' +
			  '<div class="x-combo-list-item">{[this.name]}</div>',
			'</tpl>',
			{
			  shouldShowHeader: function(path){
				var pathArr = path.split('/');
				this.name = pathArr.pop(); // remove project
				return this.currentKey !== pathArr.join('/');
			  },
			  showHeader: function(path){
				var pathArr = path.split('/');
				pathArr.pop(); // remove project
				this.currentKey = pathArr.join('/');
				return this.currentKey;
			  },
				resetCurrentKey: function() {
					this.currentKey=null;
					return '';
				}
			}
		),
//		selectOnFocus:true,
//		forceSelection: true,
//		typeAhead: true,
		disabled:false,
		store:GO.projects2.selectProjectStore,
		fieldLabel:GO.projects2.lang.project,
		pageSize: parseInt(GO.settings['max_rows_list'])
	});	
	
	
	if(config.storeBaseParams)
		config.store.baseParams = config.storeBaseParams;

	GO.projects2.SelectProject.superclass.constructor.call(this,config);
		
	this.store.setDefaultSort('path', 'asc');
	
}
Ext.extend(GO.projects2.SelectProject, GO.form.ComboBoxReset);
