	var Root   = "/";
	var WFRoot = Root + "WF/";
	
	function oldHome()
	{
		URL = "" + location;
		langue_actuelle = Langue(URL);
		
		switch (langue_actuelle)
		{
			case "en" :
				URL = "index.asp";
				break;
			case "de" :
				URL = "index_de.asp";
				break;
			case "fr" :
				URL = "index_fr.asp";
				break;
			default :
				URL = "index_fr.asp";
		}
		
		document.location = "/SSMP/" + URL ;
		
	}
	
	function Home()
	{
		URL = "" + location;

		if (URL.indexOf("/en/") != -1)
		{
			document.location = "/SSMP/index.asp";
			return;
		}

		if (URL.indexOf("/fr/") != -1)
		{
			document.location = "/SSMP/index_fr.asp";
			return;
		}
		
		if (URL.indexOf("/de/") != -1)
		{
			document.location = "/SSMP/index_de.asp";
			return;
		}

		pos = URL.indexOf("lg=")
		if (pos != -1)
		{
			document.location.pathname = "/SSMP/WF/Templates/HomePageInternet.asp";
			return;
		}

		document.location = "/SSMP/index.asp";
		return;
		
	}
	
	function Langue(URL)
	{
		langue = "en";
		
		if (URL.indexOf("/en/") != -1)
		{
			langue = "en";
		}

		if (URL.indexOf("/fr/") != -1)
		{
			langue = "fr";
		}
		
		if (URL.indexOf("/de/") != -1)
		{
			langue = "de";
		}

		pos = URL.indexOf("lg=")
		if (pos != -1)
		{
			langue = URL.substr(pos + 3, 2);
		}
		
		return langue;
		
	}
	
	function UpperString(Chaine)
	{
    var str = Chaine.split('');
		var result = '';
		
    for(i=0; i<=str.length-1; i++)
		{
			str[i]  = str[i].toUpperCase();
			result+=str[i];
		}
		
		return result;
	}
	
	function Traduction(langue)
	{
		URL = "" + document.location;

		if (UpperString(URL).indexOf(WFRoot) == -1)
		{
			langue_actuelle = Langue(URL);
			pos = URL.indexOf("/" + langue_actuelle + "/");
			if (pos == -1)
			{
				newURL = URL;
			}
			else
			{
				newURL = URL.substr(0, pos) + "/" + langue + "/" + URL.substr(pos + 4);
				document.location = newURL;
			}
		}
		else
		{
			pos = URL.indexOf("lg=")
			if (pos != -1)
			{
				newURL = URL.substr(0, pos) + "lg=" + langue + URL.substr(pos + 5);
				document.location = newURL;
			}
		}
	}
	
	function TraduireURL(URL, langue)
	{
		if (URL == "")
		{
			URL = "" + location;
		}
		
		if (URL.indexOf(WFRoot) == -1)
		{
			langue_actuelle = Langue(URL);
			pos = URL.indexOf("/" + langue_actuelle + "/");
			if (pos == -1)
			{
				newURL = URL;
			}
			else
			{
				newURL = URL.substr(0, pos) + "/" + langue + "/" + URL.substr(pos + 4);
			}
		}
		else
		{
			pos = URL.indexOf("lg=")
			if (pos != -1)
			{
				newURL = URL.substr(0, pos) + "lg=" + langue + URL.substr(pos + 5);
			}
		}
		
		return newURL;
	}
	
	function TraduireForm(Langue)
	{
		document.fiche.action = TraduireURL("", Langue);
		document.fiche.submit();
	}
		
	function popRFQList()
	{
		URL = "" + location;

		switch(Langue(URL))
		{
			case "en" :
				dimensions = 'width=307,height=275';
				break;
			
			case "fr" :
				dimensions = 'width=325,height=315';
				break;
			
			case "de" :
				dimensions = 'width=330,height=300';
				break;
	
			default :
				dimensions = 'width=307,height=275';
				break;
		}		
			
		URLRFQ = '/SSMP/WF/Templates/Sourcings/PopRfqList.asp?lg=' + Langue(URL);
		RFQWindow = window.open(URLRFQ,'','toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,status=no,width=760,height=600');	

		URLPromo = '/SSMP/' + Langue(URL) + '/Rfq/promotion.htm';
		WindowPromo = window.open(URLPromo,'','toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=no,status=no,' + dimensions);	
	
	}

	
