if(typeof MLUtil == 'undefined')
	MLUtil = {};
if(typeof MLUtil.Resource == 'undefined')
	MLUtil.Resource = {};


/* extend class  */
MLUtil.Resource.Util = Class.create();
Object.extend(MLUtil.Resource.Util.prototype, {
	_locale_default : "en",
	_locale : null,
	_resourceFile : "/js/resource/js_resource_lang",
	
	initialize: function(strLocale) {
		this._locale = strLocale;
	},
	
	// load resource by lang
	load: function() {
		try {
			var objJSHead = document.getElementsByTagName('head')[0];
			var objJSScript = null;
			var strResourceUri = null;
			
			if (this._locale == null || this._locale == "") {
				strResourceUri = this._resourceFile + ".js";
			} else {
				strResourceUri = this._resourceFile + "_" + this._locale + ".js";
			}
			objJSScript= document.createElement('script');
			objJSScript.id= "js_resource";
			objJSScript.type= "text/javascript";
			objJSScript.charset= "UTF-8";
			objJSScript.src= strResourceUri;
			objJSScript.text= "/* resource file */";
			
			objJSHead.appendChild(objJSScript);
		} catch (ex) {
			alert(gx.description);
		}
		return;
	},
	
	// load resource by lang
	get: function(strKey) {
		var strLocaleText = null;
		
		try {
			strLocaleText = eval("MLUtil.Resource." + strKey+ ";");
			
			if (strLocaleText == null || strLocaleText == "") {
				return "";
			}
		} catch (ex) {
			alert(gx.description);
		}
		return strLocaleText;
	}	
});
