/* Copyright 2008 Tuscon.com.au. Parts copyright Ext JS. Other licenses available on request. */Ext.onReady(function(){Ilode.load_logos('featured');Ext.form.Field.prototype.msgTarget='under';var resultTpl=new Ext.XTemplate('<tpl for=".">','<div class="search-item">','{title}','</div>','</tpl>');var ds=new Ext.data.Store({url:'/company/data/search',reader:new Ext.data.JsonReader({root:'results',totalProperty:'total',id:'id'},[{name:'id',mapping:'id'},{name:'title',mapping:'title'},{name:'logo',mapping:'logo'}]),baseParams:{limit:20},listeners:{'update':function(){Ext.get('searchinfo').dom.innerHTML='<h1>Found ?</h1>';}}});var search=new Ext.form.ComboBox({fieldLabel:'Search',store:ds,id:'companysearch',displayField:'title',typeAhead:false,minChars:2,loadingText:'Searching...',valueNotFoundText:'No companies found.',width:350,listWidth:600,hideTrigger:false,triggerClass:'x-form-search-trigger',tpl:resultTpl,emptyText:'Enter company name',itemSelector:'div.search-item',onSelect:function(record){window.location='/company/view/'+Ilode.util.safe_title(record.get('title'))+'/'+record.id+'?source=search'}});search.on('collapse',function(combo){if(combo.store.getTotalCount()==0){combo.markInvalid('No company found matching "'+combo.getValue()+'"');}});new Ext.form.FormPanel({border:false,renderTo:'search-panel',items:[search]});});