PastelBaseBootstrap.prototype.constructor = PastelBaseBootstrap;

function PastelBaseBootstrap() {

	//IE ajax login fix !!
	this._sId = "";
	
	var _xhr = null;
	
	/**
	 * @type XMLHttpRequest
	 * @return the XMLHttpRequest object of the application
	 */
	this.getXHR = function() {
		return _xhr;
	};
	
	this.setXHR = function(xhr) {
		_xhr = xhr;
	};
	
	var _stateNotifier = null;
	this.getStateNotifier = function() {
		if (_stateNotifier == null) {
			_stateNotifier = new PastelStateChangeNotifier();
		}
		return _stateNotifier;
	};
 
	var _eventQueue = null;
	this.getEventQueue = function() {
		if (_eventQueue == null) {
			_eventQueue = new PastelEventQueue();
		}
		return _eventQueue;
	};
	
	this.popupManager = new PastelPopupManager();
	
	this.alertManager = new PastelAlertManager();
	
	this.url = new URLUtil();
	
	this.lang = "bg";
	
	this.start = function(controller, lang) {
		
		if (lang != undefined) {
			this.lang = lang;
		}
		
		if (controller != null && 
			controller != undefined) {
			controller.showView();
			this.getStateNotifier().trigger();
		}
	};
  
	var defaultAjaxErrorHandler = null;
	
	this.setDefaultAjaxErrorHandler = function(handler) {
		defaultAjaxErrorHandler = handler;
	};
	
	this.getDefaultAjaxErrorHandler = function() {
		return defaultAjaxErrorHandler;
	};
}
