Ext.onReady(function() {

var locationCombo = new Ext.form.ComboBox({
	renderTo:'location',
	store: new Ext.data.Store({
		url:'actions/json/searchLocations.cfm',
		autoLoad:true, 
		reader:new Ext.data.JsonReader({
			totalProperty:'recordcount', 
			root:'data', 
			id: 'locationid'}, 
			Ext.data.Record.create([{name: 'locationid'}, {name: 'locationname'}]))}),
			id:'locationCombo',
			valueField: 'locationid',
			displayField: 'locationname',
			typeAhead: true,
			mode: 'remote',
			forceSelection: true,
			minChars:1,
			triggerAction: 'all',
			emptyText:'Select a location',
			selectOnFocus:true,
			label: '',
			listeners:{
				'select':function(){
					//alert(locationCombo.getValue())
					document.location = 'http://www.360physicaltherapy.com/locations.cfm?locId=' + locationCombo.getValue();
				}
			}
});

var insuranceCombo = new Ext.form.ComboBox({
	renderTo:'insurance',
	store: new Ext.data.Store({
		url:'actions/json/searchInsurance.cfm',
		autoLoad:true, 
		reader:new Ext.data.JsonReader({
			totalProperty:'recordcount', 
			root:'data', 
			id: 'insuranceid'}, 
			Ext.data.Record.create([{name: 'insuranceid'}, {name: 'insurancename'}]))}),
			id:'insuranceCombo',
			width:250,
			valueField: 'insuranceid',
			displayField: 'insurancename',
			typeAhead: true,
			mode: 'remote',
			forceSelection: true,
			minChars:2,
			triggerAction: 'all',
			emptyText:'Select insurance...',
			selectOnFocus:true,
			label: '',
                    listeners:{
                        expand:function(insuranceCombo){
                            //var comboZ = parseInt(requestWindow.getEl().getStyle("z-index"));
                            insuranceCombo.list.setZIndex(1);
                        }
                    } 			
});

});
