﻿function translateToFr() {
var oldURL;
var start;
var newURL;
 
 oldURL = parent.location.toString();
 start = oldURL.lastIndexOf("Welcome.html");
 if (start != -1) {
	 newURL = oldURL.substr(0,start) + "Bienvenue.html";
 } else {
	 start = oldURL.indexOf(".en.html");
         newURL = oldURL.substr(0,start) + ".fr.html";
 }
 parent.document.location = newURL;
}

function translateToEn() {
var oldURL;
var start;
var newURL;

 oldURL = parent.location.toString();
 if (oldURL.lastIndexOf("/") == oldURL.length - 1) {
 	oldURL = oldURL + "Bienvenue.html";
 }
 start = oldURL.lastIndexOf("Bienvenue.html");
 if (start != -1) {
	 newURL = oldURL.substr(0,start) + "Welcome.html";
 } else {
	 start = oldURL.indexOf(".fr.html");
         newURL = oldURL.substr(0,start) + ".en.html";
 }
 parent.document.location = newURL;
}

function translatephpToFr() {
var oldURL;
var start;
var newURL;
 
 oldURL = parent.location.toString();
 start = oldURL.lastIndexOf("Welcome.php");
 if (start != -1) {
	 newURL = oldURL.substr(0,start) + "Bienvenue.php";
 } else {
	 start = oldURL.indexOf(".en.php");
         newURL = oldURL.substr(0,start) + ".fr.php";
 }
 parent.document.location = newURL;
}

function translatephpToEn() {
var oldURL;
var start;
var newURL;

 oldURL = parent.location.toString();
 if (oldURL.lastIndexOf("/") == oldURL.length - 1) {
 	oldURL = oldURL + "Bienvenue.php";
 }
 start = oldURL.lastIndexOf("Bienvenue.php");
 if (start != -1) {
	 newURL = oldURL.substr(0,start) + "Welcome.php";
 } else {
	 start = oldURL.indexOf(".fr.php");
         newURL = oldURL.substr(0,start) + ".en.php";
 }
 parent.document.location = newURL;
}
