﻿if (!iMap){
	var iMap=new Object();
}
iMap.countryHttpProxy=new Ext.data.HttpProxy({url: 'cmdHandler.ashx?cmd=loadCountries'});

iMap.CountryRecordDef = Ext.data.Record.create([
	{name: 'iso'},{name: 'id'},{name: 'icon'},{name: 'description'},{name:'country'}
]);

iMap.xmlCountryReader = new Ext.data.XmlReader({
		record: "row",
		id: "id"
}, iMap.CountryRecordDef);
iMap.imm_countryStore=new Ext.data.Store({
				reader: iMap.xmlCountryReader,
				proxy: iMap.countryHttpProxy,
				sortInfo:{field: 'country', direction: "ASC"}
				/*,
				listeners:{'load':function(){iMap.countrystoreLoaded=true;_st('iMap.imm_countryGrid.doLayout();',500)}}*/
		});
Ext.onReady(function(){
		
		
		iMap.imm_countryGrid = new Ext.grid.GridPanel({
				store: iMap.imm_countryStore,
				loadMask: true,
				autoHeight:true,
				//deferRowRender :false,
				viewConfig: {
        forceFit: true
    },

				columns: [
				{id:'id',header: "id", width: 60,hidden:true, sortable: true, dataIndex: 'id'},
				{header: "", width: 30, sortable: false, dataIndex: 'icon'},
				{header: "country", width: 70, sortable: true, dataIndex: 'country'}
				],
				  sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
  
				frame:false,
				width: 300,
				height: 'auto',
				hideHeaders :true,
				visible:true,
				collapsible: true,
				collapsed:false,
				enableHdMenu: false,
				//animCollapse: animatePanels,
				iconCls: 'icon-grid',
				renderTo: 'country_panel'
		});
		iMap.imm_countryGrid.getSelectionModel().on('rowselect',
	function(sm, rowIndex, r) {iMap.doCmd("switchCountry",r.data.id);
	_st("iMap.showPanel();",500);
		
});
			}
);



