
Ext.apply(Ext.MessageBox, {
	
	exceptions: new Application.Exceptions()
		
	,showError: function (cfg) {
		this.show({
		   title:'Errors',
		   msg: cfg.msg,
		   buttons: Ext.Msg.OK,
		   fn: Ext.emptyFn,
		   icon: Ext.MessageBox.ERROR,
		   maxWidth: 300	
		});
	}
	
	,showAppError: function (type) {
		var e = this.exceptions;
		var cfg = {
			msg: this.exceptions.getMsg(type)
		}
		this.showError(cfg);
	}
	
	,showResponseError: function (statusCode) {
		this.showError(this.getResponseErrorCfg(statusCode));
	}
	
	,getResponseErrorCfg: function (statusCode) {
		var cfg = { };
		switch (statusCode) {
			case 404: 	Ext.apply(cfg, {
							msg: 'File not found 404.'
						});	
						break;
			case 230: 	Ext.apply(cfg, {
							msg: 'Security Error. Not allowed to post to different url.'
						});	
						break;
			case 500:  	Ext.apply(cfg, {
							msg: 'Internal Server Error.'
						});	
						break;
			default: 	Ext.apply(cfg, {
							msg: 'Error.'
						});
		}
		return cfg;
	}
});


