Zfse = {
	_settings : new Object(),	
	
	_loaded : new Array(),
		
	init : function(settings){
		Zfse._settings = settings;
	},

	/**
	 * Loads module with parameters
	 * 
	 * @param {String} module
	 * @param {Array} params
	 */
	loadModule : function(module, params){
		var arr, path, uri;

		if(typeof(params) == 'object'){
			for(var key in params){
				eval(key+' = params[key];');
			}
		}
		
		if(typeof(module) != 'Array'){
			arr = [module];
		}

		for(var i=0;i<arr.length;i++){
			path = Zfse._parseClassPath(arr[i]);
			uri = Zfse.getSetting('libUri')+'/'+path;
			
			Zfse.requireOnce(uri);
		}
	},
	
	/**
	 * Loads script once
	 * 
	 * @param {String} uri
	 */
	requireOnce : function(uri){
		if(!Zfse.isLoaded(uri)){
			document.write('<scr', 'ipt src="', uri, '" type="text/JavaScript"><\/scr', 'ipt>');
		}
	},
	
	/**
	 * Returns true if script is loaded
	 * 
	 * @param {String} uri
	 * @returns {Boolean}
	 */
	isLoaded : function(uri){
		for(var i = 0; i<Zfse._loaded.length; i++){
			if(Zfse._loaded[i] == uri){
				return true;
			}
		}
		
		return false;
	},
	
	/**
	 * Returns value for setting
	 * 
	 * @param setting
	 * @returns string
	 */
	getSetting : function(setting){
		switch(setting){
			case 'imageUri':
				return this.getSetting('libUri') + '/../images';
				break;
			case 'mediaUri':
				return this.getSetting('libUri') + '/../media';
				break;
			default:
				return Zfse._settings[setting];
				break;
		}
	},
	
	_parseClassPath : function(className){
		var items = className.split('_');
		
		if(items[0]){
			return items.join('/') + '.js';
		}
		else{
			return className + '.js';
		}
		
	}
}
