/*Kelda.Info.BankRatesGrid = function(config) {
	this.category = '01';
	Ext.apply(this,config);
}; 
*/
	
Kelda.Info.BankRatesGrid = Ext.extend(Ext.grid.GridPanel,{
	
	initComponent : function() {
		var pctChange = function(val){
			v = val.toFixed(2);
			if(val > 0){
				return '<span style="color:green;">' + v + '%</span>';
			}else if(val < 0){
				return '<span style="color:red;">' + Math.abs(v) + '%</span>';
			}
			return v;
		};
		this.rowActions = keldanNewRowaction(10);
		this.cellActions = new Ext.ux.grid.CellActions({
			listeners:{
				action:function(grid, record, action, value) {
					Ext.ux.Toast.msg('Event: action', 'You have clicked: <b>{0}</b>, action: <b>{1}</b>', value, action);
				}
				,beforeaction:function() {
					Ext.ux.Toast.msg('Event: beforeaction', 'You can cancel the action by returning false from this event handler.');
				}
			}
			,callbacks:{
				'icon-undo':function(grid, record, action, value) {
					Ext.ux.Toast.msg('Callback: icon-undo', 'You have clicked: <b>{0}</b>, action: <b>{1}</b>', value, action);
				}
			}
			,align:'left'
		});
		columns=[{
			id: 'FullName',
			header: keldan_lang_text('name'),
			dataIndex: 'fullName',
			hidden:true,
			menuDisabled:true,
			sortable:false,
			width: 40
		},{
            id: 'instrumenttype', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
        	header: keldan_lang_text('bank'),
        	dataIndex: 'instrumentType',
        	width: 40,
        	renderer: function(value,p,record) {
        		p.attr = 'ext:qtip="'+record.data.description+'" ext:qtitle="'+record.data.fullName+'"';
        		return value;
        	},
        	tooltip:keldan_lang_text('banktooltip'),
        	hidden:false,
        	menuDisabled:true,
        	sortable:false
        },{
            id: 'description', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: keldan_lang_text('description'),
            dataIndex: 'description',
            width: 100,
            hidden:true,
            menuDisabled:true,
            //renderer: this.renderTopic,
            sortable: false
        },{
        	id:'summary',
        	header :keldan_lang_text('bind'),
        	dataIndex:'summary',
        	width:30,
        	menuDisabled:true,
        	sortable:false,
        	tooltip:keldan_lang_text('bindtooltip'),
        	hidden:false
        },{
            id: 'Last', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: keldan_lang_text('rates'),	
            dataIndex: 'last',
            tooltip:keldan_lang_text('ratestooltip'),
            width: 20,
            menuDisabled:true,
            renderer: function(val) {
				return val.toFixed(2)+"%";
			},
            sortable: false
        },{
            id: 'Updated', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: keldan_lang_text('dateshort'),
            dataIndex: 'updated',
            tooltip:keldan_lang_text('bankrates-datetooltip'),
            width: 40,
            hidden:false,
            menuDisabled:true,
            renderer:Ext.util.Format.dateRenderer('d/m/y'),
        	sortable: false
        },{
            id: 'category', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
        	header: keldan_lang_text('category'),
        	dataIndex: 'category',
        	width: 5,
        	menuDisabled:true,
        	renderer:function(val) {
        		return val.substring(3,val.length-1);
        	},
        	hidden:true,
        	sortable:false
        },this.rowActions];
		
	    this.bankstore = new Ext.data.GroupingStore({
	    	autoDestroy:true,
			reader : new Ext.data.JsonReader({
				root: 'response',
	        	id:'bankRatesJsonId',
	            fields: [ {name:'instrumentType'},{name:'summary',convert:function(val,rec){
	            	return keldan_lang_text(val);
	            }},
	            	{name:'last',type:'float'},{name:'updated',mapping:'lastUpdated',type: 'date', dateFormat: 'timestamp'},
			{name:'name'},
	            	{name:'fullName'},
	            	{name:'description'},
	            	{name:'category'},
	            	{name:'iconPdf'}
	            ]
			}),
            proxy: new Ext.data.HttpProxy({
                //url: window.location.protocol+"//"+window.location.hostname+"/"+basePath+"feedconnect/getFeed"
            	url: window.location.protocol+"//"+window.location.hostname+"/"+basePath+"connector/getBankRates"
            })
		    //sortInfo:{field:'summary',direction:'DESC'}
            
        });
	    this.bankstore.on('load',function(store,recs,opt){
	    	if(this.loadMask.disable)
	    		this.loadMask.disable();
	    	store.sort('summary','DESC');
	    	store.sort('last','DESC');
	    	if(Ext.Msg.isVisible()) {
				keldan_store_count--;
				Ext.Msg.updateProgress((keldan_fixed_stcount-keldan_store_count)/keldan_fixed_stcount
						,keldan_fixed_stcount-keldan_store_count+' af '+keldan_fixed_stcount);
				if(keldan_store_count==0) {
					Ext.Msg.hide();
					keldan_store_count=-1;
				}
			}
	    },this);
	    
		var view = new Ext.grid.GridView( {
			forceFit : true,
			autoFill:true,
            enableRowBody:true,
            scrollOffset:1,
            showPreview:false,
            autoExpandColumn:'description',
            getRowClass : function(record, rowIndex, p, store){
				if ((parseInt(rowIndex) % 2) == 0)
					return 'odd-row';

			},
			autoExpandColumn:'instrumenttype'
			
		});
		
		Ext.apply(this,{
			id: 'bankrates_'+Math.random()*1001,
			stateId:'bankrates_'+this.category,
    		store : this.bankstore,
    	    columns:columns,
    	    view:view,
    	    enableColumnHide:false,
	    plugins: [this.rowActions]
    	    
    	});
		
		//this.bankstore.load({params:{feedName:'bankRates',category:this.category}});
    	
    	var cat = this.category;
    	var banks = this.bankstore;
    	this.banktask = {
	        	run:function() {
					//banks.load({params:{feedName:'bankRates',category:cat}});
    				banks.load({params:{category:cat}});
				},
				interval: 3600000
		};
    	/*
		this.on('render',function(){
			//console.log('render '+this.category);
			if(this.getStore().loadOptions)
				return;
			else
				Ext.TaskMgr.start(this.banktask)
		},this);
		*/
    	this.on('show',function(){
    		Ext.TaskMgr.start(this.banktask);
    	});
    	this.on('hide',function(){
    		Ext.TaskMgr.stop(this.banktask);
    	});
    	this.on('destroy',function(){
    		Ext.TaskMgr.stop(this.banktask);
    	});
    	Kelda.Info.BankRatesGrid.superclass.initComponent.apply(this,arguments);
	},
	 stopPoll : function() {
		Ext.TaskMgr.stop(this.banktask);
	},
	startPoll : function() {
		Ext.TaskMgr.start(this.banktask);
	}
});
Ext.reg('BankRatesPortlet_Child',Kelda.Info.BankRatesGrid);
Kelda.Info.BankRatesPortlet = Ext.extend(Ext.Panel,{
	title: '',
	layout:'fit',
	plugins: [Ext.ux.PortletPlugin],
    closeable: true,
    maximizable:false,
    settings: false,
    resizeable:false,
    collapsible:true,
    nohelp:true,
    version:1.0001,
    width:400,
    height:(Ext.isIE7?258:254)
    
});
Ext.reg('BankRatesPortlet',Kelda.Info.BankRatesPortlet);


Kelda.Info.ReiborGrid = Ext.extend(Ext.grid.GridPanel,{
	
	initComponent : function() {
	
		this.defaultRenderer = function(val) {
			if(isNaN(val) || val=='' || val == 0)
				return '-';
			return Kelda.Info.ValueRenderer(val,keldan_lang)+"%";
		};
		this.rowActions = keldanNewRowaction(10);
		var iconrenderer = function(dataValue,metadata,record,rowIndex,colIndex,store) {
			
			if(dataValue=='REIBID' || dataValue=='REIBOR')
				dataValue='ISK';
			return "<div id=\"currency-icon\"><p><img src=\"themes/hfvtheme/images/currencies/"+
			dataValue+".png\" align=\"absmiddle\"/> " +
					dataValue+"</p></div>";
					
					
		};
		var periodWidth = 20;
		var dateW = 32;
		var nameW = 22;
		if(Ext.isIE) {
			periodWidth=24;
			dateW = 32;
			nameW=24;
			
		}
		else if(Ext.isChrome) {
			periodWidth=28;
			dateW = 38;
			nameW = 30;
		}
		this.cbankcolumns=[{
			id: 'Rates',
			header: keldan_lang_text('rates'),
			dataIndex: 'name',
			renderer: function(val,p,rec) {
				
				if(val.indexOf("LIBOR") == 0) {
					p.attr = 'ext:qtip="'+keldan_lang_text('onmouse-libor-'+rec.data.currency)+'"';
					return rec.data.currency
				}else if(val=='REIBID') {
					p.attr = 'ext:qtip="'+keldan_lang_text('onmouse-reibid')+'"';
					return 'Reibid';
				}else if(val=='REIBOR') {
					p.attr = 'ext:qtip="'+keldan_lang_text('onmouse-reibor')+'"';
					return 'Reibor';
				}else if(val=='EURIBOR') {
					p.attr = 'ext:qtip="'+keldan_lang_text('onmouse-euribor')+'"';
					return 'Euribor';
				}else
					return val;
					
			},
			hidden:false,
			width: nameW
		},{
            id: 'ratesDate', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
        	header: keldan_lang_text('dateshort'),
        	dataIndex: 'lastUpdated',
        	width: dateW,
        	renderer:Ext.util.Format.dateRenderer('d/m/y'),
        	hidden:false,
        	sortable:true
        },{
            id: 'rateson', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "ON",
            dataIndex: 'sn',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            //renderer: this.renderTopic,
            sortable: true
        },{
            id: 'sw', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "SW",
            dataIndex: 'onew',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            hidden:(keldan_screen=='s'?true:false),
            //renderer: this.renderTopic,
            sortable: true
        },{
            id: 'tw', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "2W",
            dataIndex: 'twow',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            //renderer: this.renderTopic,
            sortable: true,
            hidden:true
        },{
            id: 'thrw', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "3W",
            dataIndex: 'onew',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            //renderer: this.renderTopic,
            sortable: true,
            hidden:true
        },{
            id: 'onem', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "1M",
            dataIndex: 'onem',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            //renderer: this.renderTopic,
            sortable: true
        },{
            id: 'twom', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "2M",
            dataIndex: 'twom',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            //renderer: this.renderTopic,
            sortable: true,
            hidden:true
        },{
            id: 'threem', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "3M",
            dataIndex: 'threem',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            //renderer: this.renderTopic,
            sortable: true
        },{
            id: 'fourm', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "4M",
            dataIndex: 'fourm',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            //renderer: this.renderTopic,
            sortable: true,
            hidden:true
        },{
            id: 'fivem', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "5M",
            dataIndex: 'fivem',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            //renderer: this.renderTopic,
            sortable: true,
            hidden:true
        },{
            id: 'sixm', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "6M",
            dataIndex: 'sixm',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            //renderer: this.renderTopic,
            sortable: true
        },{
            id: 'sevenm', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "7M",
            dataIndex: 'sevenm',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            //renderer: this.renderTopic,
            sortable: true,
            hidden:true
        },{
            id: 'eightm', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "8M",
            dataIndex: 'eightm',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            //renderer: this.renderTopic,
            sortable: true,
            hidden:true
        },{
            id: 'ninem', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "9M",
            dataIndex: 'ninem',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            hidden:true	,
            //renderer: this.renderTopic,
            sortable: true,
            hidden:true
        },{
            id: 'tenm', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "10M",
            dataIndex: 'tenm',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            //renderer: this.renderTopic,
            sortable: true,
            hidden:true
        },{
            id: 'elevenm', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "11M",
            dataIndex: 'elevenm',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            //renderer: this.renderTopic,
            sortable: true,
            hidden:true
        },{
            id: 'twelvem', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: "1Y",
            dataIndex: 'twelvem',
            renderer:this.defaultRenderer,
            width: periodWidth,
            align:'right',
            hidden:false,
            //renderer: this.renderTopic,
            sortable: true
        },this.rowActions];
		this.cbankstore = new Ext.data.JsonStore({
				root: 'response',
				autoDestroy:true,
	        	id:'cbankRatesJsonId',
	            fields: [ {name:'name',type:'string'},{name:'lastUpdated',type:'date',dateFormat:'timestamp'},
	            	{name:'currency'},{name:'sn',type:'float',defaultValue:'-'},{name:'onew',type: 'float'},{name:'twow',type:'float'},
	            	{name:'threew',type:'float'},{name:'onem',type:'float'},{name:'twom',type:'float'},
	            	{name:'threem',type:'float'},{name:'fourm',type:'float'},{name:'fivem',type:'float'},
	            	{name:'sixm',type:'float'},{name:'sevenm',type:'float'},{name:'eightm',type:'float'},
	            	{name:'ninem',type:'float'},{name:'tenm',type:'float'},{name:'elevenm',type:'float'},
	            	{name:'twelvem',type:'float'},{name:'category'}
	            ],
	            proxy: new Ext.data.HttpProxy({
	            	//url: window.location.protocol+"//"+window.location.hostname+"/"+basePath+"feedconnect/getFeed"
	            	url: window.location.protocol+"//"+window.location.hostname+"/"+basePath+"connector/getBBALibor"
	            }),
		    	sortInfo:{field:'category',direction:'ASC'}
        });
		this.cbankstore.on('load',function(){
			this.loadMask.disable();
			if(Ext.Msg.isVisible()) {
				keldan_store_count--;
				Ext.Msg.updateProgress((keldan_fixed_stcount-keldan_store_count)/keldan_fixed_stcount
						,keldan_fixed_stcount-keldan_store_count+' af '+keldan_fixed_stcount);
				if(keldan_store_count==0) {
					Ext.Msg.hide();
					keldan_store_count=-1;
				}
			}
		},this);
		this.cbankview = new Ext.grid.GridView( {
			forceFit : true,
			autoFill:true,
            enableRowBody:true,
            scrollOffset:1,
            showPreview:false,
            autoExpandColumn:'rates',
            getRowClass : function(record, rowIndex, p, store){
				if ((parseInt(rowIndex) % 2) == 0)
					return 'odd-row';
			},
			columnsText:keldan_lang_text('columns'),
			sortAscText:keldan_lang_text('sort ascending'),
			sortDescText:keldan_lang_text('sort descending')
		});
		Ext.apply(this,{
			id: 'libor_'+Math.random()*120,
			stateId:'liborgrid',
    		store : this.cbankstore,
    	    columns:this.cbankcolumns,
    	    view:this.cbankview,
    	    autoHeight:true,
	    plugins:[this.rowActions],
    	    loadMask:{msg:keldan_lang_text('loading'),removeMask:true}
    	});
		//this.cbankstore.load({params:{feedName:'centralBankRates'}});
		/*
		this.on('mouseover',function(e,t){
			e.stopEvent();
			var row,col;
			if( (row = this.getView().findRowIndex(t))!== false && (col=this.getView().findCellIndex(t))!==false) {
				if(col <= 1)return;
				var rec = this.getStore().getAt(row);
				var header = this.getColumnModel().getColumnHeader(col);
				
				var didx = this.getColumnModel().getDataIndex(col)
				var headerCell = this.getView().getHeaderCell(col);
				var rowCell = this.getView().getCell(row,0);
				var htmlel = this.getView().getCell(row,col);
				Ext.DomHelper.applyStyles(htmlel,{
					'border':'black 0px solid',
					'background-color':'#71b1d8',
					'color':'white'
					
				});
				var pre ='';var exp = '';
				
					var ticker = rec.data.currency;
					if(rec.data.name.indexOf('LIBOR') == -1)
						ticker = 'ISK';
					pre = '<pre><b>'+ticker+' :<br/> '+header+' = '+Kelda.Info.ValueRendererFour(rec.data[didx],keldan_lang)+' %</b></pre>'; 
					
				var tt1 = new Ext.ToolTip({
					target:htmlel,
					html:pre+exp,
					showDelay:0,
					hideDelay:0,
					trackMouse:true,
					frame:true,
					dismissDelay:0
				});
			}
		},this);
		this.on('mouseout',function(e,t){
			e.stopEvent();
			var row,col;
			if( (row = this.getView().findRowIndex(t))!== false && (col=this.getView().findCellIndex(t))!==false) {
				if(col <= 1)return;
				var headerCell = this.getView().getHeaderCell(col);
				var htmlel = this.getView().getCell(row,col);
				Ext.DomHelper.applyStyles(htmlel,{
					'border':'none',
					'background-color':'transparent',
					'color':'black',
					'font-size' : '11px'
				});
			}
		},this);
    	*/
		
    	var s = this.cbankstore;
    	this.cbanktask = {
	        	run:function() {
    				//s.load({params:{feedName:'centralBankRates'}});
    				s.load({params:{feedName:'centralBankRates'}});
				},
				interval: 3600000
		};
		
    	
    	this.on('render',function(comp) {
    		
    		Ext.TaskMgr.start(this.cbanktask);
    	});
    	this.on('destroy',function(){
    		Ext.TaskMgr.stop(this.cbanktask);
    	});
    	Kelda.Info.ReiborGrid.superclass.initComponent.apply(this,arguments);
	},
	 stopPoll : function() {
		Ext.TaskMgr.stop(this.cbanktask);
	},
	startPoll : function() {
		Ext.TaskMgr.start(this.cbanktask);
	}
});
Ext.reg('ReiborPortlet_Child',Kelda.Info.ReiborGrid);
Kelda.Info.ReiborRatesPortlet = Ext.extend(Ext.Panel,{
	title: '',
	//layout:'fit',
	plugins: [Ext.ux.PortletPlugin],
    closeable: true,
    maximizable:false,
    settings: false,
    resizeable:false,
    collapsible:true,
    collapsed:true,
    nohelp:true,
    version:1.0001,
    width:400,
    //height:106
    autoHeight:true,
    listeners : {
    	'render' : {
    		fn : function(panel) {
    			
	    		if(panel.collapsed) {
	    			
	    			if(Ext.Msg.isVisible()) {
	    				keldan_store_count--;
	    				Ext.Msg.updateProgress((keldan_fixed_stcount-keldan_store_count)/keldan_fixed_stcount
	    						,keldan_fixed_stcount-keldan_store_count+' af '+keldan_fixed_stcount);
	    				if(keldan_store_count==0) {
	    					Ext.Msg.hide();
	    					keldan_store_count=-1;
	    				}
	    			}
	    		}
    		}
    	}
    }
    
});
Ext.reg('ReiborPortlet',Kelda.Info.ReiborRatesPortlet);


Kelda.Info.CBIRatesGrid = Ext.extend(Ext.grid.GridPanel,{
	
	initComponent : function() {
	
		this.defaultRenderer = function(val) {
			if(isNaN(val))
				return '-';
			return Kelda.Info.ValueRenderer(val,keldan_lang)+"%";
		};
		this.rowActions = keldanNewRowaction(10);	
		this.cbicolumns=[{
			id: 'name',
			header: '',
			dataIndex: 'description',
			hidden:false,
			width: 80
		},{
            id: 'value', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
            header: keldan_lang_text('rates'),
            dataIndex: 'last',
            renderer:this.defaultRenderer,
            width: 20,
            hidden:false,
            //renderer: this.renderTopic,
            sortable: true
        },{
            id: 'ratesDate', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
        	header:keldan_lang_text('updated'),
        	dataIndex: 'lastUpdated',
        	width: 25,
        	renderer:Ext.util.Format.dateRenderer('d/m/y'),
        	hidden:false,
        	sortable:true
        },this.rowActions];
		
		this.cbistore = new Ext.data.JsonStore({
				autoDestroy:true,
				root: 'response',
	        	id:'cbiRatesJsonId',
	            fields: [ {name:'name'},{name:'last',type:'float'},{name:'lastUpdated',type:'date',dateFormat:'timestamp'},
	            	{name:'description',convert : function(val,rec) {
	            		return keldan_lang_text(val);
	            	}},{name:'category'}
	            ],
	            proxy: new Ext.data.HttpProxy({
	            	//url: window.location.protocol+"//"+window.location.hostname+"/"+basePath+"feedconnect/getFeed"
	            	url: window.location.protocol+"//"+window.location.hostname+"/"+basePath+"connector/getISCBRates"
	            }),
	            sortInfo:{field:'category',direction:'ASC'}
            
        });
		this.cbistore.on('load',function(){
			this.loadMask.disable();
			if(Ext.Msg.isVisible()) {
				keldan_store_count--;
				Ext.Msg.updateProgress((keldan_fixed_stcount-keldan_store_count)/keldan_fixed_stcount
						,keldan_fixed_stcount-keldan_store_count+' af '+keldan_fixed_stcount);
				if(keldan_store_count==0) {
					Ext.Msg.hide();
					keldan_store_count=-1;
				}
			}
		},this);
		this.cbiview = new Ext.grid.GridView( {
			forceFit : true,
			autoFill:true,
            enableRowBody:true,
            scrollOffset:1,
            showPreview:false,
            autoExpandColumn:'rates',
            getRowClass : function(record, rowIndex, p, store){
				if ((parseInt(rowIndex) % 2) == 0)
					return 'odd-row';

			}
			
			
		});
		Ext.apply(this,{
			id:'cbirates_'+Math.random()*929,
			stateId:'cbirates',
    		store : this.cbistore,
    	    columns:this.cbicolumns,
    	    view:this.cbiview,
    	    autoHeight:true,
	    plugins:[this.rowActions],
    	    loadMask:{msg:keldan_lang_text('loading'),removeMask:true}
    	});
		//this.cbankstore.load({params:{feedName:'centralBankRates'}});
		
    	
    	var s = this.cbistore;
    	this.cbanktask = {
	        	run:function() {
    				//s.load({params:{feedName:'centralBankRates'}});
    				s.load();
				},
				interval: 3600000
				//interval:60000
		};
		
    	this.on('render',function(comp) {
    		
    		Ext.TaskMgr.start(this.cbanktask);
    	});
    	this.on('destroy',function(){
    		Ext.TaskMgr.stop(this.cbanktask);
    	});
    	Kelda.Info.CBIRatesGrid.superclass.initComponent.apply(this,arguments);
	},
	 stopPoll : function() {
		Ext.TaskMgr.stop(this.cbanktask);
	},
	startPoll : function() {
		Ext.TaskMgr.start(this.cbanktask);
	}
});
Ext.reg('CBIRatesPortlet_Child',Kelda.Info.CBIRatesGrid);
Kelda.Info.CBIRatesPortlet = Ext.extend(Ext.Panel,{
	title: '',
	layout:'fit',
	plugins: [Ext.ux.PortletPlugin],
    closeable: true,
    maximizable:false,
    settings: false,
    resizeable:false,
    collapsible:true,
    collapsed:true,
    nohelp:true,
    version:1.0001,
    width:400,
    listeners : {
    	'render' : {
    		fn : function(panel) {
    			
	    		if(panel.collapsed) {
	    			
	    			if(Ext.Msg.isVisible()) {
	    				keldan_store_count--;
	    				Ext.Msg.updateProgress((keldan_fixed_stcount-keldan_store_count)/keldan_fixed_stcount
	    						,keldan_fixed_stcount-keldan_store_count+' af '+keldan_fixed_stcount);
	    				if(keldan_store_count==0) {
	    					Ext.Msg.hide();
	    					keldan_store_count=-1;
	    				}
	    			}
	    		}
    		}
    	}
    }
    
    //height:106
    
});
Ext.reg('CBIRatesPortlet',Kelda.Info.CBIRatesPortlet);

