
/**
 * @author egli
 */

/**
 * Namespace
 */

if (EN == undefined) {
    var EN = {}
};

/**
 * Main application class
 */

EN.Application = function(){

    // Prepare for Member Variables
    var that = this;

	// Init
	this.init = function() {
		var callback = function() {
			// Load the css files and initialize the controls
			var cssUrls = ['jslib/elstr/' + LIBS.elstrVersion + '/assets/elstr.css'];
			ELSTR.loader("css", cssUrls);

			// Load the script files and start application
			var scriptUrls = [
					'jslib/elstr/' + LIBS.elstrVersion + '/build/Language.js',
					'jslib/elstr/' + LIBS.elstrVersion + '/build/User.js'];
			ELSTR.loader("script", scriptUrls, function() {
				YAHOO.util.Event.onDOMReady(function() {
					// Init the language class and panel
					ELSTR.lang = new ELSTR.Language();
					ELSTR.lang.init("services/ELSTR_LanguageServer",
							ELSTR.applicationData.language, false, "");

					initializeControls();
					startApplication();
				});
			});
		}
		ELSTR.loadAppData(LIBS.appName, callback);
	};


    // Initialize all controls and gui elements
    var initializeControls = function(){


    }

    var startApplication = function(){

    }
};

/**
 * Start the application here and add main Object to Namespace
 */

EN.app = new EN.Application();

EN.loader = new YAHOO.util.YUILoader( {
	base : 'jslib/yui/' + LIBS.yuiVersion + '/build/',
	loadOptional : true,
	filter: LIBS.yuiFilter,
	combine: LIBS.yuiCombine,
	allowRollup : true
});

EN.loader.addModule( {
	name : 'ELSTR',
	type : 'js',
	varName : "ELSTR",
	fullpath : 'jslib/elstr/' + LIBS.elstrVersion + '/build/Elstr.js',
	requires : [ 'yahoo', 'dom', 'event', 'json', 'get', 'datasource' ]
});

EN.loader.require("yahoo", "dom", "event",
		"datasource", "json");
EN.loader.require("reset", "fonts", "grids", "base");
EN.loader.require("ELSTR");
EN.loader.insert( {
	onSuccess : EN.app.init
});