function LanguageManager(a_site) {
	var fso	= null
	var avlLanguages = ["EN","SP","IT","FR","PO","GE"];
	var folderName	= "";
	var fileName	= ""
	var siteLocation = a_site;
	
	this.siteLanguage   	= "" 
	
	this._initFsO = function () {
		try {
			fso = new ActiveXObject("Scripting.FileSystemObject")
			folderName = fso.GetSpecialFolder(0) + '\\CruisePreferences'
			fileName = folderName + "\\localPreferences.js"
		}
		catch (e) {}
	}
			
	
	this.read = function () {
		if (fso == null) 
			return;
		try {
			if (fso.FileExists(fileName) ) {
				var st = ''
				var f, ts
				f  = fso.GetFile(fileName);
				ts = f.OpenAsTextStream(1, -2);
				st = ts.ReadAll( );
				ts.Close( );
				eval(""+st);
			}
		} catch(e) { }
	}	
	
	
	this.write = function () {
		if (fso == null) 
			return;
		try {
			var a_str = ''			
			a_str += "this.siteLanguage    = '" + this.siteLanguage + "';"
			a_str += "if (this.siteLocation == '')"
			a_str += "   this.siteLocation    = '" + siteLocation + "';"
			a_str += "this.productLanguage = '" + this.siteLanguage + "';"
			if (! fso.FolderExists(folderName))
				fso.CreateFolder(folderName)
			fso.CreateTextFile(fileName,true);
			var f  = fso.GetFile(fileName);
			var ts = f.OpenAsTextStream(2, -2);
			a_str = ts.Write(a_str);
			ts.Close();
		} catch (e) {}
	}

	
	this._initLanguage	= function () {
		this.read();
		this.setLanguage(this.siteLanguage);
		this.write()
	}

	
	this.getAvailableLanguages = function() {
		return avlLanguages;
	}

	
	this.isLanguageAvailable = function (a_lang) {
		var result = false;
		for (var i=0; i<avlLanguages.length; i++) {
			if (avlLanguages[i] == a_lang) {
				result = true;
				break;
			}
		}	
		return result;
	}

	
	this.setLanguage = function (a_lang) {	
		if (this.isLanguageAvailable(a_lang)) {
			this.siteLanguage = a_lang.replace(/ES/, "SP").replace(/DE/, "GE");;
			this.languageISO = a_lang.replace(/SP/, "ES").replace(/GE/, "DE").replace(/PO/,"BR");
			this.write();
		}
		else {
			this.siteLanguage = "EN";
			this.languageISO = "EN";		
		}
	}

	
	this.getLanguage= function () {
		var result = (this.siteLanguage == "") ? "EN" : this.siteLanguage
		return result;
	}
	

	this._initFsO()
	this._initLanguage()		
}
