var ajaxRoot = 'http://testzone.tmpw.de/tkt/typo3conf/ext/tmp_thyssenkrupp/pi1/';

var store = new Ext.data.JsonStore({
    url: ajaxRoot + 'words.php', 
    root: 'words',
    totalProperty: 'totalCount',
    id: 'word', 
    fields: ['word', 'count']
});

// Custom rendering Template
var resultTpl = new Ext.XTemplate(
    '<tpl for="."><div class="x-combo-list-item suggest-item">',
        '<span class="suggest-word">{word}</span>',
        '<span class="suggest-count">({count})</span>',
    '</div></tpl>'
);

var search = new Ext.form.ComboBox({
    store: store,
    displayField: 'word',
    typeAhead: true,
    minChars: 1, 
    /*tpl: resultTpl, */
    loadingText: 'Loading...',
    hideTrigger: true,
    applyTo: 'text', 
    queryDelay: 250, 
    listeners: {
    	expand: {
    		fn: function(combo) { 
    			if(Ext.isIE6) 
    			{
    				Ext.get('jobportal-region').hide();
    				Ext.get('jobportal-sector').hide();
    				Ext.get('jobportal-function').hide();
				}
    		}
		}, 
		collapse: {
    		fn: function(combo) { 
    				Ext.get('jobportal-region').show();
    				Ext.get('jobportal-sector').show();
    				Ext.get('jobportal-function').show();
    		}
		}
	}
});
