<!--//

	// Client-side Global Configuration
	var protectedPaths = new Array("/member/", "/emag/", "/_edm/");
	var devSiteTokens  = new Array("localhost:","/ftphamus/");


	function switchLang(langCode)
	{
		var currUrl = window.location.toString();
		if (langCode.length > 0)
		{
			if (currUrl.indexOf('?') == -1)
			{
				window.location = currUrl + '?lang=' + langCode;
			}
			else
			{
				currUrl = currUrl.replace('#','');
				currUrl = currUrl.replace('?lang=EN','?');
				currUrl = currUrl.replace('?lang=ZH','?');
				currUrl = currUrl.replace('&lang=EN','');
				currUrl = currUrl.replace('&lang=ZH','');
				window.location = currUrl + '&lang=' + langCode;
			}
		}
	}
	
	
	function isDevEnv()
	{
		var res = false;
		for (t = 0; t < devSiteTokens.length; ++t)
		{
			if (currUrl.indexOf(devSiteTokens[t]) != -1)
			{
				res = true;
			}
		}
		return res;
	}



	// SSL Configuration for Clarins website
	var currUrl = window.location.toString();
	var noSslRequired = true;
	
	for (i = 0; i < protectedPaths.length; ++i)
	{
		if (currUrl.indexOf(protectedPaths[i]) != -1)
		{
			noSslRequired = false;
			if (currUrl.indexOf("https://") == -1 && currUrl.indexOf("http://") != -1)
			{
				// Make sure the current environment is not a testing environment
				// (Assume that only production environment has SSL support)
				if (!isDevEnv())
				{
					self.location = currUrl.replace("http://","https://");
				}
			}
		}
	}
	if (noSslRequired && currUrl.indexOf("https://") != -1 )
	{
		self.location = currUrl.replace("https://","http://");
	}
	
//-->