function altLang() {
// Language Flipper By Phil Barnes.
// Updated by Tausif Kaderdina
// Requires Files to be rigidly named acording to language.
// For example index_e.htm = English, corresponding French = index_f.htm
// French and English Files are located in the same directory.
// Syntax: English or Francais
var urlLocation = "" + window.location;
var languageLocation = urlLocation.indexOf("_e.htm");
var additionalInfo = "";
// If the user types in a folder in the address bar and loads the index_e.htm page by default
// this will append "index_e.htm" to the variable so that the language flipper
// will go to the index_f.htm page.
if (urlLocation.charAt(urlLocation.length - 1) == '/'){
urlLocation = urlLocation + ('index_e.htm');
languageLocation = urlLocation.indexOf("_e.htm");
}
if (languageLocation < 0) {
// Could not find '_e.htm', assume a French file to be converted to Englsih.
languageLocation = urlLocation.indexOf("_f.htm");
if (languageLocation < 0) {
// Could not find either '_e.htm' or '_f.htm'
window.alert('No Corresponding Alternate Language Page Available.\n\nAucune page alternative correspondante de langage disponible.');
return;
} else {
// Change '_f.htm' to '_e.htm'
var newExtention = '_e.htm';
}
} else {
// Change '_e.htm' to '_f.htm'
var newExtention = '_f.htm';
}
//If arguments are passed in a URL (eg. /index.htm?phone=5551234), don't discad the arguments.
if (urlLocation.charAt(languageLocation + 6) == '?')
additionalInfo = urlLocation.substring(languageLocation + 6);
var newLocation = urlLocation.substring(0, languageLocation) + newExtention + additionalInfo;
window.location = newLocation;
}