var pThisLocaleSwap;function LocaleSwap(){pThisLocaleSwap=this;this._pUrlManager=new UrlManager();this._szSoftware=null;this._szLocale=this._pUrlManager.getArg("c_locale");}
LocaleSwap.prototype._pUrlManager;LocaleSwap.prototype._pBinDec;LocaleSwap.prototype._szLocale;LocaleSwap.prototype._szSoftware;LocaleSwap.prototype.setEventHandler=function(){clib_add_event_handler(window,'load',this.create_locale_dropdown,false);}
LocaleSwap.prototype.setSoftware=function(szSoftware){if(szSoftware){this._szSoftware=szSoftware;}}
LocaleSwap.prototype._getSoftware=function(){return this._szSoftware;}
LocaleSwap.prototype.create_locale_dropdown=function(){clib_set_dropdown(document.getElementById("LocaleMenu"),document.getElementById("LocaleList"));document.getElementById("LocaleMenu").replace=false;var pElement=document.getElementById("LocaleMenu");pElement.onchange=pThisLocaleSwap['change_locale'];}
LocaleSwap.prototype.change_locale=function(){var szNewLocale=pThisLocaleSwap.getNewLocale();var newUrl=pThisLocaleSwap._getNewUrl(szNewLocale);window.location=newUrl;}
LocaleSwap.prototype.getNewLocale=function(){var dropdown=document.getElementById('LocaleMenu');var id=dropdown.selectedItem.getAttributeNode('id').nodeValue;var larray=id.split('_');return larray[1];}
LocaleSwap.prototype._getNewUrl=function(szNewLocale){var i_mode=this._pUrlManager.getArg("i_mode");i_mode|=1<<1;if(i_mode&1&&this._pUrlManager.isArg("c_software")){i_mode=i_mode&~1;}
this._pUrlManager.setArg("i_mode",i_mode);this._pUrlManager.setArg("c_locale",szNewLocale);this._pUrlManager.setArg("c_old_locale",this._szLocale);var szSoftware=this._getSoftware();if(szSoftware&&!this._pUrlManager.isArg("c_software")){this._pUrlManager.setArg("c_software",szSoftware);}
this._pUrlManager.addSubDomain(szNewLocale);return this._pUrlManager.getUrl();}