/**
 * @author camilo
 * @inherits BaseMVC
 */


ApplicationControl = BasicMVC.Base.extend({
	
	
	
	constructor: function()
	{
	 	this.name = "ApplicationControl";
	},

	eventListeners: function()
	{
		return [
			ApplicationControl.STARTUP
		];
	},
	
	eventHandlers: function(eventMessage)
	{
	 	switch(eventMessage.name)
		{
			case ApplicationControl.STARTUP: 
				this.startup();
				break;
		}
	}, 	


	startup: function()
	{
		var es = new Bronson.ExternalScript();
		es.debug = true;
		es.addToQueue("/public/js/stores/model/StoresModel.js");
		es.addToQueue("/public/js/stores/control/AllStoresListControl.js");
		es.addToQueue("/public/js/stores/control/OnlineStoresListControl.js");
		es.addToQueue("/public/js/stores/control/MapListControl.js");
		es.addToQueue("/public/js/stores/view/AllStoresListView.js");
		es.addToQueue("/public/js/stores/view/OnlineStoresListView.js");
		es.addToQueue("/public/js/stores/view/MapListView.js");
		es.addToQueue("/public/js/lib/jquery.tooltiper-0.5.js");
		es.addToQueue("/public/js/lib/jquery.colorBlend.js");
		es.loadQueue(this.loadedApp, this);
	},
	
	loadedApp: function()
	{
		this.facade.register(new StoresModel());
		this.facade.register(new AllStoresListControl());	
		this.facade.register(new OnlineStoresListControl());
		this.facade.register(new MapListControl());
		this.facade.register(new AllStoresListView());
		this.facade.register(new OnlineStoresListView());
		this.facade.register(new MapListView());
	 	this.sendEvent(ApplicationControl.STARTUP_FINISHED);
	//	this.sendEvent(StoresModel.LOAD_MAP_LIST, 1, 30, -200, -200, 200, 200);
		this.sendEvent(StoresModel.LOAD_CITIES_AND_COUNTRIES);
		this.sendEvent(MapListControl.OPEN_VIEW);
	}	
	
});
	
ApplicationControl.STARTUP = "ApplicationControl.STARTUP";
ApplicationControl.STARTUP_FINISHED = "ApplicationControl.STARTUP_FINISHED";







